3.4.7 • Published 6 years ago

nbo-rest v3.4.7

Weekly downloads
3
License
GPL-3.0
Repository
gitlab
Last release
6 years ago

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

3.4.7

6 years ago

3.4.6

6 years ago

3.4.5

6 years ago

3.4.4

6 years ago

3.4.3

6 years ago

3.4.2

6 years ago

3.4.1

6 years ago

3.4.0

6 years ago

3.3.4

7 years ago

3.3.3

7 years ago

3.3.2

7 years ago

3.3.1

7 years ago

3.3.0

7 years ago

3.2.6

7 years ago

3.2.5

7 years ago

3.2.4

7 years ago

3.2.3

7 years ago

3.2.2

7 years ago

3.2.1

7 years ago

3.2.0

7 years ago

3.1.4

7 years ago

3.1.3

7 years ago

3.1.2

7 years ago

3.1.1

7 years ago

3.1.0

7 years ago

3.0.2

7 years ago

3.0.1

7 years ago

3.0.0

7 years ago

2.3.1

7 years ago

2.3.0

7 years ago

2.4.2

7 years ago

2.4.1

7 years ago

2.4.0

7 years ago

2.2.0

7 years ago

2.1.1

7 years ago

2.1.0

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.3.5

7 years ago

1.3.4

7 years ago

1.3.3

7 years ago

1.3.2

7 years ago

1.3.1

7 years ago

1.3.0

8 years ago

1.2.0

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago

0.1.0

8 years ago

0.0.28

8 years ago

0.0.27

8 years ago

0.0.26

8 years ago

0.0.25

8 years ago

0.0.24

8 years ago

0.0.23

8 years ago

0.0.22

8 years ago

0.0.21

8 years ago

0.0.20

8 years ago

0.0.19

8 years ago

0.0.18

8 years ago

0.0.17

8 years ago

0.0.16

8 years ago

0.0.15

8 years ago

0.0.14

8 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago