Skip to content

Instantly share code, notes, and snippets.

@kenu
Created February 28, 2022 06:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenu/606176842b456fd35875e368b3eebb09 to your computer and use it in GitHub Desktop.
Save kenu/606176842b456fd35875e368b3eebb09 to your computer and use it in GitHub Desktop.
jsdoc
const express = require('express');
const router = express.Router();
/**
* @openapi
* /api/hello:
* get:
* description: Welcome to swagger-jsdoc!
* parameters:
* - name: name
* in: query
* required: false
* schema:
* type: string
* responses:
* 200:
* description: Returns a mysterious string.
*/
router.get('/hello', function (req, res, next) {
const name = req.query.name || 'World';
res.json({ message: `Hello ${name}` });
});
module.exports = router;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment