How to use the @nestjs/swagger.SwaggerModule function in @nestjs/swagger

To help you get started, we’ve selected a few @nestjs/swagger examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github notadd / next / packages / server / server.js View on Github external
const address = `http://${host}:${port}`;
            const application = yield core_1.notaddFactory.start(modules_1.ApplicationModule, {
                bodyParser: true,
                cors: true,
                logger: services_1.LogService,
            });
            application.use(express.static(process.cwd() + "/public/"));
            application.useGlobalPipes(new common_1.ValidationPipe());
            if (swaggerConfiguration.enable) {
                const options = new swagger_1.DocumentBuilder()
                    .setTitle("Notadd")
                    .setDescription("API document for Notadd.")
                    .setVersion("2.0")
                    .addBearerAuth()
                    .build();
                const document = swagger_1.SwaggerModule.createDocument(application, options);
                swagger_1.SwaggerModule.setup(`/${swaggerConfiguration.endpoint}`, application, document);
            }
            const callback = () => {
                if (graphqlConfiguration.ide.enable) {
                    this.logger.log(`Graphql IDE Server on: ${address}/graphiql`);
                }
                if (swaggerConfiguration.enable) {
                    this.logger.log(`Swagger Server on: ${address}/${swaggerConfiguration.endpoint}`);
                }
                this.logger.log(`Server on: ${address}`);
            };
            index = process.argv.indexOf("--host");
            if (index > -1) {
                yield application.listen(port, process.argv[index + 1], callback);
            }
            else if (serverConfiguration.http.host && serverConfiguration.http.host !== "*") {
github notadd / next / packages / server / server.js View on Github external
bodyParser: true,
                cors: true,
                logger: services_1.LogService,
            });
            application.use(express.static(process.cwd() + "/public/"));
        }
        application.useGlobalPipes(new common_1.ValidationPipe());
        const swaggerConfiguration = loaders_1.Configuration.loadSwaggerConfiguration();
        if (serverConfiguration.adapter !== "fastify" && swaggerConfiguration.enable) {
            const options = new swagger_1.DocumentBuilder()
                .setTitle("Notadd")
                .setDescription("API document for Notadd.")
                .setVersion("2.0")
                .addBearerAuth()
                .build();
            const document = swagger_1.SwaggerModule.createDocument(application, options);
            swagger_1.SwaggerModule.setup(`/${swaggerConfiguration.endpoint}`, application, document);
        }
        const callback = () => {
            if (graphqlConfiguration.ide.enable) {
                this.logger.log(`Graphql IDE Server on: ${address}/graphiql`);
            }
            if (serverConfiguration.adapter !== "fastify" && swaggerConfiguration.enable) {
                this.logger.log(`Swagger Server on: ${address}/${swaggerConfiguration.endpoint}`);
            }
            this.logger.log(`Server on: ${address}`);
        };
        index = process.argv.indexOf("--host");
        if (index > -1) {
            await application.listen(port, process.argv[index + 1], callback);
        }
        else if (serverConfiguration.http.host && serverConfiguration.http.host !== "*") {
github notadd / next / packages / server / server.js View on Github external
cors: true,
                logger: services_1.LogService,
            });
            application.use(express.static(process.cwd() + "/public/"));
        }
        application.useGlobalPipes(new common_1.ValidationPipe());
        const swaggerConfiguration = loaders_1.Configuration.loadSwaggerConfiguration();
        if (serverConfiguration.adapter !== "fastify" && swaggerConfiguration.enable) {
            const options = new swagger_1.DocumentBuilder()
                .setTitle("Notadd")
                .setDescription("API document for Notadd.")
                .setVersion("2.0")
                .addBearerAuth()
                .build();
            const document = swagger_1.SwaggerModule.createDocument(application, options);
            swagger_1.SwaggerModule.setup(`/${swaggerConfiguration.endpoint}`, application, document);
        }
        const callback = () => {
            if (graphqlConfiguration.ide.enable) {
                this.logger.log(`Graphql IDE Server on: ${address}/graphiql`);
            }
            if (serverConfiguration.adapter !== "fastify" && swaggerConfiguration.enable) {
                this.logger.log(`Swagger Server on: ${address}/${swaggerConfiguration.endpoint}`);
            }
            this.logger.log(`Server on: ${address}`);
        };
        index = process.argv.indexOf("--host");
        if (index > -1) {
            await application.listen(port, process.argv[index + 1], callback);
        }
        else if (serverConfiguration.http.host && serverConfiguration.http.host !== "*") {
            await application.listen(port, serverConfiguration.http.host, callback);
github notadd / next / packages / server / server.js View on Github external
const application = yield core_1.notaddFactory.start(modules_1.ApplicationModule, {
                bodyParser: true,
                cors: true,
                logger: services_1.LogService,
            });
            application.use(express.static(process.cwd() + "/public/"));
            application.useGlobalPipes(new common_1.ValidationPipe());
            if (swaggerConfiguration.enable) {
                const options = new swagger_1.DocumentBuilder()
                    .setTitle("Notadd")
                    .setDescription("API document for Notadd.")
                    .setVersion("2.0")
                    .addBearerAuth()
                    .build();
                const document = swagger_1.SwaggerModule.createDocument(application, options);
                swagger_1.SwaggerModule.setup(`/${swaggerConfiguration.endpoint}`, application, document);
            }
            const callback = () => {
                if (graphqlConfiguration.ide.enable) {
                    this.logger.log(`Graphql IDE Server on: ${address}/graphiql`);
                }
                if (swaggerConfiguration.enable) {
                    this.logger.log(`Swagger Server on: ${address}/${swaggerConfiguration.endpoint}`);
                }
                this.logger.log(`Server on: ${address}`);
            };
            index = process.argv.indexOf("--host");
            if (index > -1) {
                yield application.listen(port, process.argv[index + 1], callback);
            }
            else if (serverConfiguration.http.host && serverConfiguration.http.host !== "*") {
                yield application.listen(port, serverConfiguration.http.host, callback);