1.1.4 • Published 10 months ago

apidocify v1.1.4

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

Apidocs

Automatically generate Swagger/OpenAPI documentation for your Express APIs.

Installation

npm install apidocs

After installing it add in tot he main server file for your api

const express = require('express');
const Apidocify = require('apidocify');

const app = express();
const port = 3000 || process.env.port;

// Add routes
app.get('/users', (req, res) => res.send('Users route'))
.apidoc = {
    summary: 'Get all users',
    responses: {
      200: { description: 'List of users' },
      500: { description: 'Server error' }
    }
};

app.post('/users', (req, res) => res.send('User created'));

// Initialize apidocify  after defing all your route
new Apidocify(app, {
  docsPath: '/docs',
  title: 'kashyap api',
  version: '2.0.0'
});

app.listen(port, () => {
  console.log(`Server running on port ${port}`);
});

After this run your server and hit the /docs route for api documentation

node server.js

feel free to submit pullrequest.

1.1.4

10 months ago

1.1.3

10 months ago

1.1.2

10 months ago

1.1.1

10 months ago

1.1.0

10 months ago

1.0.0

10 months ago