Socket
Socket
Sign inDemoInstall

express-rest-orm

Package Overview
Dependencies
191
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    express-rest-orm

rest interface generation for sequelize models


Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

express-rest-orm

travis coveralls npm-version npm-downloads npm-license twitter

express-rest-orm generates an express Router that serves a list of sequelize Models via a full-featured REST api.

getting started

Get the latest version of express-rest-orm via npm:

npm install [--save] express-rest-orm

Then use it to serve your sequelize Models:

var app = require('express')()
  , Sequelize = require('sequelize')
  , orm = new Sequelize('example', ...)
  , models = [orm.define('foo', ...), orm.define('bar', ...)];

app.use('/api/v1', require('express-rest-orm')(models));

running the tests

Tests are the main source of documentation for this module. They are kept readable so that they will not only pass but also convey information to the reader.

npm test

will run all tests and give a spec as well as coverage information.

See the latest travis build if you don't want to run the tests locally.

feature list

This is both a documentation of the features of express-rest-orm and a backlog of planned improvements. It is more or less copied from express-persistent-resource.

  • /: all resources
    • OPTIONS /: list methods
    • GET /: list resource urls
    • POST /: create resource
    • PUT /: bulk update resources
    • DELETE /: delete all resources
  • /:id: a single resource
    • GET /:id: read resource
    • POST /:id: error -> use PUT /:id or POST /
    • PUT /:id: update resource
    • DELETE /:id: delete resource
  • /:id/:field: all nested resources
    • GET /:id/:field: list nested resources (simulate with GET /:id?fields=:field)
  • ?: query parameters
    • ?include_docs=true: when GET /?include_docs, list docs instead of urls
    • ?:field=: list resources that match filter on field. Support
      • =: exact match
      • ~=: one of
      • |=: exact match or starts with + - (namespacing)
      • ^=: starts with
      • $=: ends with
      • *=: contains
    • ?fields=: partial response (filtered by untyped.validate)
    • ?limit= and ?offset=: pagination (limit entries per call, offset entries skipped)
    • ?q=: search resources for query
    • ?method=: override http method with method (GET /?method=POST equals POST /)
    • ?suppress_response_codes=true: override response code with 200, put response code in result
  • .:ext: resource serialization
    • .json: (default) resources as json
    • .xml: resources as xml
    • .yml: resources as yaml
  • Accept:: resource serialization
    • */json: resources as json
    • */xml: resources as xml
    • */yml: resources as yaml

Keywords

FAQs

Last updated on 22 May 2015

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc