Skip to content

A node package used to display all the registered endpoints of the project and send them with password protection to anyone using the API.

Notifications You must be signed in to change notification settings

parammittal16/node-express-docs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

node-express-docs

npm version

NPM

NO NEED TO ASK ENDPOINTS FROM YOUR BACKEND DEVELOPER EVERY MINUTE

A node package used to display all the registered endpoints of the project and send them with password protection to anyone using the API.

How To Install

It is just a development dependency

npm install node-express-docs --save-dev

Or it can be used as a full dependency

npm install node-express-docs --save

How to use

const showEndpoints = require('node-express-docs');

In main app.js/index.js/server.js

Just After you use your routes middlewares like

app.use('/', RouteXYZ);

Paste the code below

app.get("/__docs", (req, res, err)=> {
  if(req.query.pass === 'YOUR_SECRET'){
    res.send(showEndpoints(app));
  }
  else{
    res.send("<html><body><h2>UnAuthorized</h2></body></html>")
  }
});

Output

Got to 

localhost:3000/__docs?pass=YOUR_SECRET 

to see your endpoints.

You can also set a Secret by replacing 'YOUR_SECRET' and share the pass with your Front-end co-workers. THANKS

About

A node package used to display all the registered endpoints of the project and send them with password protection to anyone using the API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published