import { INestiaConfig } from "@nestia/sdk";
import { Module, VersioningType } from "@nestjs/common";
import { NestFactory } from "@nestjs/core";
const NESTIA_CONFIG: INestiaConfig = {
input: async () => {
const app = await NestFactory.create(MyModule);
app.setGlobalPrefix("api");
app.enableVersioning({
type: VersioningType.URI,
prefix: "v",
});
return app;
},
output: "src/api",
e2e: "src/test",
swagger: {
output: "swagger.json",
security: {
bearer: {
type: "apiKey",
},
},
},
};
export default NESTIA_CONFIG;
From now on, you can configure INestApplication
instance to the INestiaConfig.input
property. Therefore, finally, you can utilize special features of NestJS like setGlobalPrefix()
, enableVersioning()
, and RouterModule
.
The reason why I had not supported those features were I had not known how to get TypeScript controller files' locations in the runtime environment. In today, I could get the locations of TypeScript controller files through get-function-location library. Special thanks to @rwjblue and his amazing strategy utilizing the inspector
module.
Also, you can specify target configuration and project files by using --config [file] --project [file]
options like below, instead of using nestia.config.ts
and tsconfig.json
files.
npx nestia sdk --config something.config.ts --project anything.tsconfig.json
What's Changed
- Close #656 -support multiple nestia.config.ts file. by @samchon in #659
- Print CLI output when running
npx nestia setup
. by @samchon in #662 - Supports
INestApplication
onnestia.config.ts
file by @samchon in #661 - Documentation for v2.3 update by @samchon in #663
- Report errors during SDK generation. by @samchon in #668
- Complement #563: new CLI option
--project
. by @samchon in #669
Full Changelog: v2.2.5...v2.3.2