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

mera

v0.9.1

Published

A framework to easily create a REST API from a mongoose model

Readme

MERA

Mongoose and Express built RESTful API

Output

As you build a REST API with mera, you get APIs:

  • GET /?querya=xx&queryb=xx&start_time=xx&end_time=xx&_filter=xx&_page=x&_perPage=x
    • Fully supported List
      • Any allowed field can be added as a query field for filtering
      • JSON string can passed in by _filter, if you prefer
      • Use start_time and end_time to filter a time range if timeFilter is set
      • Use _page and _perPage for pagination, X-Total-Count in response head for total count
      • Use _sortDir (ASC|DESC) and _sortField to sort any allowed field
      • Use format= to export a certain format, now supports
        • csv
        • xlsx
        • json (default)
  • GET /:id
    • Get by ID, simply enough
  • POST /
    • Use JSON body to create a new doc; any unknown field or not allowed field will be omitted
  • PUT /:id
    • Use JSON body to update a doc, similar
  • DELETE /:id
    • Delete by ID

Samples

// Create a mongoose model as usual
var mongoose = require('mongoose'), Schema = mongoose.Schema;

var personSchema = new Schema({
  firstName: String,
  lastName: String
});

var Person = mongoose.model('Person', personSchema);

// Create the router with the model
var mera = require('mera');
var router = mera(Person, {
  props: // the properties to be filter at listing, creating or updating
  propsMapping: // [api prop]: [model prop], if any to be mapped, id: '_id' is always added
  baseFilter: // used at listing
  defaultSort: // used at listing
  protects: // { LIST: function(req, cb), GET: , PUT: , ... } // to protect a certain method
  _id: // String, used as { options._id: req.params.id } when /:id is passed in
  omitProps: // [String], list of all props to omit at output, 'output' is always omitted
  uploadProps: // {'upload_file_prop': 'prop_to_be_replaced', }
  timeFilter: // 'field_name', to use this field for time search
  textFields: [String] // field to be search as text, which means using $regex operator
});

app.use('/persons', router); // use in app, all RESTful APIs are available.

and Frontend?

This API is a perfect companion of ng-admin, an Angular based management UI.

You should be able to satify 99% of your management requirements in 1 hour for a model if your db is ready.