mapple

1.0.1 • Public • Published

Mapple

A Connect middleware that matches request's url with a MongoDB document. Also allows to PUT and DELETE pages (or documents).

Usage

Install with npm install mapple. Then, where app is a connect or express app :

mapple = require('mapple');
...
app.use(mapple(db, collectionName));
  • db can be either a MongoDB URL, a Db object (created with the native driver mongodb) or a Collection object.
  • collectionName is optionnal. It's the pages collection's name. It defaults to pages.

The middleware populates res.locals.document with the db document corresponding to the requested url (url is stored in the field route of the document).

Package Sidebar

Install

npm i mapple

Weekly Downloads

6

Version

1.0.1

License

MIT

Last publish

Collaborators

  • nucky