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.
koa-sequelize-rest
Advanced tools
Readme
Generates REST middlewares for Sequelize models.
let koa = require('koa');
let Rest = require('koa-sequelize-rest');
let app = koa();
let Model = require('./model');
let ModelRest = new Rest(Model);
app.use(ModelRest.readAll());
Returns
{
"model": [
{ "value": "A" },
{ "value": "B" },
{ "value": "C" }
]
}
koa-sequelize-rest is especially handy when used alongside koa-router :
let router = koaRouter();
router.get('/', ModelRest.readAll());
router.post('/', ModelRest.create());
router.get('/:uuid', ModelRest.readOne());
router.put('/:uuid', ModelRest.update());
router.delete('/:uuid', ModelRest.delete());
app.use(router.routes());
app.use(router.allowedMethods());
new Rest(model)
Instanciate a new koa-sequelize-rest helper instance.
model
, a Sequelize modelrest
, a Rest instance tied to model
rest.getEntity(includes)
Loads a model
instance in Koa's context state
.
includes
rest.readOne()
Fetches a model
instance and returns it in the response.
rest.readAll(options)
Fetches a bunch of model
instances and returns them in the response.
options
, a javascript object passed on to Sequelize's instance.findAll
rest.create()
Creates and saves a new instance of model
, then returns the newly created instance in the response.
rest.update(options)
Updates an instance of model
, then returns the updated instance in the response.
options
, a javascript object passed on to Sequelize's instance.update
rest.delete()
Deletes an instance of model
.
MIT
FAQs
Sequelize Rest Middlewares for Koa
The npm package koa-sequelize-rest receives a total of 11 weekly downloads. As such, koa-sequelize-rest popularity was classified as not popular.
We found that koa-sequelize-rest 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.