Package Exports
- express-tenant
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-tenant) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Tenant
Express middleware for multi-tenant configuration and connection managment.
Getting started
Configuration options
export default new Tenancy({
// Convict index configuration (optional)
index,
tenants: {
default: {}, // Default config that prod/stage extend.
production,
staging
},
connections: [
{
key: 'salesforce',
getter: (modelKey, config) => getModels(modelKey, config.get('tenant')),
},
],
});import express from 'express';
import Tenancy from 'tenant';
import defaultConfig, { production, staging } from './config';
let app = express();
let tenant = new Tenancy({
index,
defaultTenant: process.env.NODE_ENV,
tenants: {
default: {}, // Default config that prod/stage extend.
production,
staging
},
connections: [
{
key: 'salesforce',
getter: (modelKey, config) => getModels(modelKey, config.get('tenant')),
},
],
});
app.use(tenant.middleware);
app.listen(3000);