Recall & Review
beginner
What is swagger-jsdoc used for in an Express app?
swagger-jsdoc generates API documentation from JSDoc comments in your code. It helps create a Swagger (OpenAPI) specification automatically.
Click to reveal answer
beginner
Which package do you use alongside swagger-jsdoc to serve the API docs in Express?
You use swagger-ui-express to serve the generated Swagger UI documentation in your Express app.
Click to reveal answer
intermediate
What is the purpose of the
swaggerDefinition object in swagger-jsdoc setup?It defines the basic info about your API like title, version, description, and server URLs. This info appears in the generated docs.
Click to reveal answer
intermediate
How do you tell swagger-jsdoc where to find your API route files for documentation?
You specify the file paths or glob patterns in the
apis array option when configuring swagger-jsdoc.Click to reveal answer
intermediate
What is the typical Express middleware setup to serve Swagger UI using swagger-jsdoc?
You create the swaggerSpec with swagger-jsdoc, then use
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerSpec)) to serve docs at /api-docs.Click to reveal answer
What does swagger-jsdoc generate from your code comments?
✗ Incorrect
swagger-jsdoc reads JSDoc comments and creates an OpenAPI (Swagger) JSON spec describing your API.
Which Express middleware package is commonly used to display swagger-jsdoc output as a web page?
✗ Incorrect
swagger-ui-express serves the Swagger UI interface to visualize the API docs generated by swagger-jsdoc.
Where do you specify the API info like title and version in swagger-jsdoc?
✗ Incorrect
The swaggerDefinition object holds metadata about your API, such as title, version, and description.
How do you tell swagger-jsdoc which files to scan for API documentation comments?
✗ Incorrect
You provide file paths or glob patterns in the apis array so swagger-jsdoc knows where to find JSDoc comments.
What URL path is commonly used to serve Swagger UI docs in an Express app?
✗ Incorrect
The path /api-docs is a common convention to serve Swagger UI documentation in Express apps.
Explain the steps to set up swagger-jsdoc and swagger-ui-express in an Express app.
Think about installation, configuration, generating spec, and serving docs.
You got /5 concepts.
Describe how swagger-jsdoc uses JSDoc comments to create API documentation.
Focus on the role of comments and how swagger-jsdoc processes them.
You got /4 concepts.