mongoose-objectid-middleware

1.0.0 • Public • Published

What is it?

This middleware will successfully throw 404 error instead of crashing the server when invalid mongodb objectId is passed in param.

Installation

npm install mongoose-objectid-middleware

Usages

Your App.js

var objectIdMiddleware = require("mongoose-objectid-middleware");

app.get("/post/:post_id",objectIdMiddleware,appController.getPost);
app.get("/post/:post_id/comment/:comment_id",objectIdMiddleware,appController.getComment);

app.listen(8080);

Package Sidebar

Install

npm i mongoose-objectid-middleware

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

1.89 kB

Total Files

3

Last publish

Collaborators

  • logicco