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

generic-rest-apis

v2.0.2

Published

Express JS generic rest api based on your sequelize models

Readme

This project was forked from generic-rest-api from luizguilhermesj

I've loved this project and made just a litle change in the way that the relations are managed in queries removing those _id from them. Otherwise visit https://www.npmjs.com/package/generic-rest-api for main suport.

generic-rest-apis

Express JS generic REST API based on your sequelize models

The goal is to make something that we can use to build APIs really fast, instead of using a full framework like sailsjs or loopback

Requirements

  • expressjs
  • sequelize

Getting Started

First you add generic-rest-api to your project:

npm install --save generic-rest-api

Then you add it as a middleware to your express app, informing the path where your sequelize models are:

var genericRestApi = require('generic-rest-api');
...
app.use(genericRestApi(__dirname+'/models'));

Let's assume you have just one model named user. The first example will add your application the following routes:

GET /user
GET /user/:id
GET /user/:id/:relation
POST /user
PUT /user/:id
DELETE /user/:id

If you want to add a prefix to your API you just need to declare it in express use:

app.use('/api/v2', genericRestApi(__dirname+'/models'));

This way your API will be:

GET /api/v2/user
[...]

You can also add some middlewares to all generic rest routes using an options argument:

var options = {
    middlewares: [
        authentication
    ]
};
app.use(genericRestApi(__dirname+'/models', options));

Authentication

There is no authentication in this module.
I know I'm forcing your hand here, but you can use a middleware for authentication and hooks on models for authorization.

Obs

If you want to override any method, you just need to add your own custom route BEFORE the middleware.

Issues

If you find any kind of issue, please make this world more beautiful and report this issue so I can correct it.
And, of course, if you want you can always make a pull request.

Next Steps

  • support Restify
  • support other ORMs