Monami ❤️
Mongoose API Middleware for Express
Testing
run npm test
to run da testz!
How to use this dude
simple rest server within seconds!!!!
var Mongoose = ;var monami = ;Mongoose;Mongoose; ; // You can mount it to your app by using// app.use('/api', monami(Mongoose));
Overrides
Monami accepts method overrides. why? lets say you never want to remove data from your DB.
this magic happens inside the reopen(modelName, overrides)
or reopen(overrides)
function.
var mon = ; mon;
You might have realized a couple of things:
- Monami will inject the model you need to use to
req.model
- Monami uses the naming convetions of rails-style rest apps. (
index
,show
,destroy
,insert
,update
)
API in short
var mon = monami(Mongoose)
Creates an express app you can mount in your express app with all the resty stuff in it.
mon.reopen(modelName, overrides)
Overrides the rest methods being called to that model.
mon;
mon.reopen(overrides)
Overrides the default rest methods
mon;
Available rest methods
index
, show
, destroy
, insert
, update
Future
- Using plain MongoDB client instead of Mongoose?
- Make the override methods use the error handling methods.
- Make the ability to override the error handling methods.
- Add "head" or other http methods?
Contribution
you know the deal.
- Fork.
- Clone & Run tests
- Branch
- Write code
- Test
- Commit
- Pull Request
- $$$.