Package Exports
- express-crud-router-sequelize-v6-adapter
- express-crud-router-sequelize-v6-adapter/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (express-crud-router-sequelize-v6-adapter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
express-crud-router-sequelize-v6-connector
Sequelize v6 connector to express-crud-router.
import crud from "express-crud-router";
import sequelizeV6Crud from "express-crud-router-sequelize-v6-connector";
app.use(crud("/admin/users", sequelizeV6Crud(User)));Install
npm install express-crud-router-sequelize-v6-routerSearch
express-crud-router-sequelize-v6-router exposes a default search helper function sequelizeSearchFields.
Here is an example:
import crud from "express-crud-router";
import sequelizeCrud, {
sequelizeSearchFields,
} from "express-crud-router-sequelize-v6-connector";
crud("/admin/users", {
...sequelizeCrud(User),
search: sequelizeSearchFields(User, ["address", "zipCode", "city"]),
});When searching some stuff, the following records will be returned in this order:
- records with a searchable field that contains
some stuff - records that have searchable fields that contain both
someandstuff - records that have searchable fields that contain one of
someorstuff
The search is case insensitive by default (except for search fields of type DataTypes.UUID where exact matches are returned). You can customize the search to make it case sensitive or use a scope:
import { Op } from "sequelize";
const search = sequelizeSearchFields(
User,
["address", "zipCode", "city"],
Op.like
);Contribute
See https://github.com/lalalilo/express-crud-router#contribute