express-autodoc

0.0.14 • Public • Published

express-autodoc

API documentation generator based on jsdoc comments for express

Maintainability Test Coverage

Quick start

Install

npm install express-autodoc --save-dev

Add documentation for your Express.js endpoint

/**
 * @description Get songs
 * @queryParam (title) The song title
 * @pathParam (:albumId) album UUID
 * @produces application/json, application/xml
 */
app.get('/api/albums/:albumId/songs', (req, res) => (
  res.json({
    title: req.title,
  })
));

Generate swagger mapping

node -e 'require("express-autodoc").generateSwagger(".")'

Supported tags

Tag Format Example
@queryParam (<name>) {type: string, required: true, default: <defaultValue> } <description> /** @queryParam (name) A name param */
@pathParam (<:name>) <description> /** @pathParam (:id) song Id */
@produces <contentType1>,<contentTypeN> /** @produces application/json */
@description <description> /** @description A description */

See more examples: simple app, app with router

Package Sidebar

Install

npm i express-autodoc

Weekly Downloads

89

Version

0.0.14

License

MIT

Unpacked Size

20.9 kB

Total Files

15

Last publish

Collaborators

  • rawmind