npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

monami

v0.0.21

Published

Mongoose API Middleware for Express

Downloads

17

Readme

Monami :heart:

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 = require('mongoose');
var monami = require('./monami');
Mongoose.connect("mongodb://localhost/monami_spec_tests");
require('../test/models')(Mongoose);

monami(Mongoose).listen(8080);

// 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 = monami(Mongoose);

mon.reopen({
  destroy: function(req, res) {
    req.model.findByIdAndUpdate(req.params.modelId, { $set: { deletedAt: Date.now() } }, function(err, data) {
      res.send("DELETED!!!!"); // LIES.
    });
  }
});

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.reopen('User', {
  index: function(req, res) { return res.status(500).send({ error: "cannot get user list." }); }
});

mon.reopen(overrides)

Overrides the default rest methods

mon.reopen({
  update: function(req, res) { return res.status(404).send({ error: "there is no update on this app!!!! haha" }); }
});

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
  • $$$.