@creative-web-solution/express-layer
v0.0.1
Published
Extra layer for ExpressJS
Downloads
69
Readme
Express Layer
See the complete documentation in the documentation
folder.
Requirements
- NodeJS >= 18
- Process Manager 2
Installation
Start in an empty folder, then:
npm i -D @creative-web-solution/express-layer
Create scaffolding:
npx expressLayer create
Initialization
The configuration is splitted in several files:
- .env
- config/app/parameters.ts
- config/app/env.ts
- config/app/helmet.ts
- config/packages/*.ts
- config/routes/*.ts
The initialization is made in the expressLayerConfiguration.ts
at the root of the project:
import type {
ExpressLayer,
ExpressLayerOptions,
} from "@creative-web-solution/express-layer";
import path from "path";
import { envSchema } from "./config/app/env";
import HELMET_CONF from "./config/app/helmet";
import routes from "./config/routes/routes";
import parameters from "./config/app/parameters";
import packages from "./config/packages";
export const expressLayerConfiguration: ExpressLayerOptions = {
parameters,
packagesConfiguration: packages,
projectRoot: path.resolve(__dirname, ".."),
envSchema,
helmetConfiguration: HELMET_CONF,
registerRoutes: async (expressLayer: ExpressLayer) => {
return routes(expressLayer);
},
registerPlugins: async (expressLayer: ExpressLayer) => {
return [
// Add plugins here
];
},
};