New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nbo-rest

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nbo-rest

Generic Rest API implementation in Javascript using NodeJS

  • 3.4.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-97.92%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 15 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc