Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for setGlobalPrefix and enableVersioning #399

Closed
pivee opened this issue Jun 15, 2023 · 4 comments
Closed

Support for setGlobalPrefix and enableVersioning #399

pivee opened this issue Jun 15, 2023 · 4 comments
Assignees
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@pivee
Copy link

pivee commented Jun 15, 2023

In the current implementation, it is required to have endpoint prefixes and version included inside @TypedRoute and having used setGlobalPrefix or enableVersioning is impossible with nestia.

It would be much more convenient if nestia had the ability to reflect on REST endpoints in the application more accurately.

/**
 * This is not supported by nestia when generating
 * swagger docs at the moment.
 */
app.setGlobalPrefix("api");
app.enableVersioning({
  type: VersioningType.URI,
  defaultVersion: "1"
});
@samchon samchon self-assigned this Jun 15, 2023
@samchon samchon added help wanted Extra attention is needed question Further information is requested labels Jun 15, 2023
@samchon
Copy link
Owner

samchon commented Jun 15, 2023

Current @nestia/sdk is looking at only controller codes.

To support that feature, @nestia/sdk needs to mount and actually run the NestJS backend server. I'd tried that way once very long time ago, but gave up it soon. It's because there had been some users that building SDK library in an environment that running the real backend server.

I think it is crazy envirionment, but of such reason, I'm very careful about this issue.

@maximseshuk
Copy link

@samchon How can we resolve the issue for now?

@ArjunAtlast
Copy link

@samchon Can't you at least support the @Version decorator and the version property in @controller decorator. This would give some workaround for us to include version in the url.

@samchon
Copy link
Owner

samchon commented Oct 19, 2023

https://nestia.io/docs/sdk/sdk/#configuration

@pivee @maximseshuk @DavidVaness @ArjunAtlast Upgrade to v2.3, then you can do it now.

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;

@samchon samchon closed this as completed Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants