0.0.7 • Published 9 months ago

@creative-web-solution/express-layer v0.0.7

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
9 months ago

Express Layer

See the complete documentation in the documentation folder.

Requirements

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
    ];
  },
};