Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Feathers schema switching in sequelize
// setup a middleware that provides access to the express headers
module.exports = (req, res, next) => {
req.feathers.headers = req.headers;
// update the model schema based on express passed headers
module.exports = function() {
return function(hook) {
if (hook.params.headers.subdomain) {
hook.service.Model = hook.service.Model.schema(
} else {
throw new Error('subdomain header missing');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment