github samchon/nestia v2.3.2

latest releases: v3.17.0, v3.16.0, v3.15.0...
11 months ago
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

Full Changelog: v2.2.5...v2.3.2

Don't miss a new nestia release

NewReleases is sending notifications on new releases.