Post Actions Scaffolder

Generate Express.js POST API action boilerplates and register routes dynamically into your endpoints.

Overview

This utility library automatically generates boilerplate controllers, DALs, validation schemas, and route templates, and injects route registration statements directly into your local end-points.js file.

💡 Programmatic Library Only

Starting with version 1.15.x, this package is designed strictly as a programmatic utility module. It does not provide command-line (CLI) interfaces.

Installation

npm install kschema-fs-api-gen-post-actions

Programmatic API Usage

Import the required action generators in your custom build script or tasks runner:

import { 
  withMail, 
  insertGenPk, 
  insertAsIs, 
  filter, 
  groupBy 
} from 'kschema-fs-api-gen-post-actions';

// Example: Generate a standard insert action boilerplate
await insertAsIs({
  toPath: './src/api',            // Directory containing your end-points.js
  inFolderName: 'InsertAsIs',      // Folder name to generate under the target directory
  inGenerateRest: false           // Generate REST specifications
});

Available Action Generators

Generator Function Output Folder Target Scaffold Description
withMail() WithMail Generates a POST action with email dispatch configuration.
insertGenPk() InsertGenPk Generates a database insert action with auto-generated primary key (UUID/ID).
insertAsIs() InsertAsIs Generates a standard insert action using parameters without key modifications.
filter() Filter Generates a database search/filter query POST action.
groupBy() groupBy Generates database groupings and aggregation actions.

Output Structure

When an action generator function runs, it scaffolds the following files inside your target directory:

[inFolderName]/
├── controller.js   # Handles requests, maps inputs, and calls DAL methods
├── dal.js          # Direct database interaction queries
├── route.js        # Defines validation middlewares and endpoints routing
└── validation.js   # Validation schema parameters

It also dynamically updates the imports and route registration inside your local end-points.js router file.

Further Documentation & Integration

To learn more about how this tool connects to other libraries and editors, explore the following pages: