req.body.** // get parameter from body /* Contains key-value pairs of data submitted in the request body. By default, it is undefined, and is populated when you use body-parsing middleware such as body-parser and multer. */
req.query.** // get parameter from query (after '?') // eg. http://localhost:3000/search?id=1&name=a
Manipulating the dataset with limit, offset, order and group
To get more relevant data, you can use limit, offset, order and grouping:
1 2 3 4 5 6 7 8 9 10 11
//Sequelize
// limit the results of the query Project.findAll({ limit: 10 })
// step over the first 10 elements Project.findAll({ offset: 10 })
// step over the first 10 elements, and take 2 Project.findAll({ offset: 10, limit: 2 })
Sequelize
hasMany & BelongsToMany
(Project)
getter will be ```user.getProjects()```. If the association is aliased, use the alias instead, e.g. ```User.hasMany(Project, { as: 'jobs' })``` will be user.getJobs().
1 2
``` public static hasMany(target: Model, options: object): HasMany
Creates a 1:m association between this (the source) and the provided target. The foreign key is added on the target.
Model -> DataBase
Instance -> rowIn the API reference below, add the name of the association to the method, e.g. for `User.hasMany