sequelize-express-findbyid
Find by id using a sequelize model, returning 404 error if not found
Install
npm i -S sequelize-express-findbyidornpm install --save sequelize-express-findbyid
API
const sef = sequelize-express-findbyid (model[, primaryKey = 'id'])
Usage
const sef = const findById = // Primary key is 'id'const findByOtherId = // Primary key is 'OtherId' router
Full await/async example inside express router
const express = const sef = const router = expressconst db = // Your sequelize modelsconst Model = dbModelName // Your modelconst findById = // Primary key is 'id' router
Related
License
MIT Copyright © Diego Rodríguez Baquero