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 🙏

© 2024 – Pkg Stats / Ryan Hefner

nbo-rest

v3.4.7

Published

Generic Rest API implementation in Javascript using NodeJS

Downloads

5

Readme

node-rest

REST API implementation in Javascript with NodeJS and Express. Built on top of Mongoose and Sequelize ORM.

Out of the box features

  • Plug and play REST API
  • RESTful API endpoints scaffolded from any database table or document schema
  • Life cycle events hooks (pre/post load/persist/update/delete)
  • Generic CRUD middleware with support for relational and non relational databases
  • Role based ACL management system
  • Users scope restrictions on any API endpoint with the " user_restricted" option
  • Restrict any API resource attributes scope

Installation

npm i nbo-rest -S

Getting started

Using ExpressJS add this line inside your default controller.

// Scaffold all your REST API with one line of code
new rest(oExpressRouter, oAuthMiddleWare, oApiConfig);

The first parameter is your Express router, the second is your auth middleware for your endpoints that need authentication, and the last one is your API configuration, here's an example:

{
  // Version
  version: '1.0',

  // Base uri endpoint
  uri: '/',

  // Database adapter for CRUD middleware
  adapter: 'mongoose', // OR "sequelize" for SQL database support

  // Default limit
  limit: 10,

  // Entities and allowed fields scope
  entities: {
    "users": {
      // Endpoint URI
      endpoint: 'users',
      // Cannot read other users
      user_restricted: { field: '_id', 'GET': true, 'POST': true, 'PUT': true, 'DELETE': true },
      // Readable attributes scope (other will be hidden and immutable)
      fields: ["_id", "username", "email", "provider", "profile", "token", "created"]
    }
  }
}

Test

Run "npm test" directly in the project folder.

Documentation

Currently at work.

Contribute

Coming soon