Nest route exporter, exports application routes with developer friendly interface for consuming them on FE apps or somewhere else.
$ npm i --save nestjs-route-exporter
$ yarn add nestjs-route-exporter --save
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/**/*"]
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
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
Nest route exporter is an MIT-licensed open source project.
- Author - Djordje Stojiljkovic
- Website - https://djordjes.com
- Twitter - @uncklegdev
Nest route exporter is MIT licensed.