Tutorial seems to be broken
See original GitHub issueI’m having issues with initializing swagger module.
My server.ts file:
import { NestFactory } from '@nestjs/core';
import { json } from 'body-parser';
import { ApplicationModule } from './modules/app.module';
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
async function bootstrap() {
const app = await NestFactory.create(ApplicationModule);
app.use(json());
const options = new DocumentBuilder()
.setTitle('Cats example')
.setDescription('The cats API description')
.setVersion('1.0')
.addTag('cats')
.build();
const document = SwaggerModule.createDocument(app, options);
SwaggerModule.setup('/api', app, document);
await app.listen(3000);
}
bootstrap();
And i have following result:
[Nest] 2632 - 2017-12-6 19:38:42 [ExceptionHandler] app.use() requires a middleware function
TypeError: app.use() requires a middleware function
at Function.use (D:\Learning\nest\project\node_modules\express\lib\application.js:210:11)
at NestApplication.use (D:\Learning\nest\project\node_modules\@nestjs\core\nest-application.js:103:22)
at exceptions_zone_1.ExceptionsZone.run (D:\Learning\nest\project\node_modules\@nestjs\core\nest-factory.js:107:48)
at Function.run (D:\Learning\nest\project\node_modules\@nestjs\core\errors\exceptions-zone.js:16:13)
at Proxy.args (D:\Learning\nest\project\node_modules\@nestjs\core\nest-factory.js:106:54)
at Function.setup (D:\Learning\nest\project\node_modules\@nestjs\swagger\swagger-module.js:11:13)
at D:\Learning\nest\project\server\server.ts:17:17
at Generator.next (<anonymous>)
at fulfilled (D:\Learning\nest\project\server\server.ts:4:58)
at <anonymous>
(node:2632) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Unhandled Runtime Exception.
(node:2632) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero
exit code.
Line 17 is where i call SwaggerModule.setup('/api', app, document)
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:8 (2 by maintainers)
Top Results From Across the Web
The tutorial seems to be broken? · Discussion #862 - GitHub
I noticed some of the links in the tutorial return a 404 error. For example https://openlayers.org/en/v4.5.0/build/ol.js. On the other hand, changing 4.5.0 ...
Read more >the tutorial seems broken / quick-start/designing-your-first-api
While the tutorial may not be broken, it gives every appearance of being broken. It has a link to Design Center that instead...
Read more >The Flutter Cupertino app tutorial seems to be broken
The Flutter Cupertino app tutorial seems to be broken ... Is it a problem with the tutorial or am I missing something?
Read more >Tutorial seems broken :: Kingspray Graffiti General Discussions
Tutorial seems broken. Guy keeps telling me to teleport to the spot I'm already sitting in. Keeps telling me to teleport, But I'm...
Read more >Solved: Re: Images in this tutorial seem to be broken - 180019
Images in this tutorial seem to be broken. Labels: Labels: Hortonworks Data Platform (HDP) · ssen. Contributor. Created 03-29-2017 09:10 PM.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same problem here !
I’ve a workarround :
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.