Skip to content

unckleg/nestjs-route-exporter

Repository files navigation

Nest Logo

Description

Nest route exporter, exports application routes with developer friendly interface for consuming them on FE apps or somewhere else.

Installation

$ npm i --save nestjs-route-exporter
$ yarn add nestjs-route-exporter --save

Note!

Before generating routes modify tsconfig.json file to not watch exported routes directory because you will end up in recursive compilation:

  ...
  
  "include": [
    "./src/**/*"
  ],

  "exclude": ["node_modules", "dist", "routes/**/*"]

Generating typescript routes

async function bootstrap() {
  const app = await NestFactory.create<NestExpressApplication>(AppModule);
  
  // Generate typescript routes file
  routeExporter(app, 'http://localhost:3001', './routes', 'index.ts'); // Will generate index.ts in root/routes dir
}

bootstrap();
  • If you have Header controller in your Nest application output will be generated in root/routes/index.ts file

Typescript

Generating javascript routes

async function bootstrap() {
  const app = await NestFactory.create<NestExpressApplication>(AppModule);
  
  // Generate typescript routes file
  routeExporter(app, 'http://localhost:3001', './routes', 'index.js'); // Will generate index.js in root/routes dir
}

bootstrap();
  • If you have Header controller in your Nest application output will be generated in root/routes/index.js file

Javascript

Support

Nest route exporter is an MIT-licensed open source project.

Stay in touch

License

Nest route exporter is MIT licensed.

About

Nest route exporter, exports application routes with developer friendly interface for consuming them on FE apps or somewhere else.

Resources

License

Stars

Watchers

Forks

Packages

No packages published