Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
sequelize-router
Advanced tools
Readme
It's tiny (2kb unminified)
It's easy to use! You can get up and running in about a minute with almost zero configuration.
It's customizable and extensible. Easily override any of the default route controllers.
Available on npm:
npm install sequelize-router
sequelize-router is middleware that runs on top of sequelize, a popular ORM for node.js applications. Therefore, make sure that you have configured a database prior to use.
(Optional) Consider using sequelize-cli to quickly scaffold models of your database to be used for even quicker deployement:
$ npm install --save-dev sequelize-cli
$ npm install --save sequelize
$ sequelize init:config init:models
var express = require('express');
// Require the sequelize-router middleware and any models to be used
var sequelizeRouter = require('sequelize-router');
var db = require('./models');
var app = express();
// Use the sequelize-router middleware as shown below
app.use('/api', sequelizeRouter(db.Inventory));
app.use('/api', sequelizeRouter(db.Store));
app.use('/api', sequelizeRouter(db.Transaction));
Inventory
, Store
and Transaction
models. Model names are lowercased and used to construct endpoints.HTTP method | URL | Description |
---|---|---|
GET | /api/inventory | Runs a findAll query on the inventory table, additionally filterable with optional query parameters. *e.g. /api/inventory?stock%5Blte%5D=50 or /api/inventory?category=home_improvement |
GET | /api/inventory/:id | Runs a findOne query on the inventory table and retrieves one record with the id specified in req.params.id . |
POST | /api/inventory/ | Runs a create query on the inventory table, using data passed in req.body to construct the new record. |
PUT | /api/inventory/:id | Runs an update query on the inventory table, using data passed in req.body to update the record with the id specified in req.params.id . By default, query parameters are ignored. |
DELETE | /api/inventory/:id | Runs an destroy query on the inventory table, using data passed in req.body to update the record with the id specified in req.params.id . By default, query parameters are ignored. |
By default, each endpoint responds with the data retrieved from the Sequelize query, or from the error returned.
Defaults are can be easily overridden for any model's methods by passing a configuration object into the sequelize-router
middleware. Further documentation on this to come.
Christian Eckenrode
FAQs
A restful route generator for Sequelize.
The npm package sequelize-router receives a total of 4 weekly downloads. As such, sequelize-router popularity was classified as not popular.
We found that sequelize-router demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.