UNPKG

@vara/custom-logic-sdk

Version:

Server Side JavaScript SDK for Custom Business Logic

35 lines (24 loc) 887 B
/** * Created by stevenchin on 1/31/17. */ 'use strict'; const fs = require('fs'); const app = require('express')(); const config = require('./config/environment/env-config'); // execute boot scripts (function execBootScripts() { const pathToBootScripts = `${__dirname}/boot-scripts`; const files = fs.readdirSync(pathToBootScripts); files.forEach((file) => { require(`${pathToBootScripts}/${file}`)(); }); })(); // load middleware that should execute before route handlers require('./src/middleware/pre-route-handling')(app, config); // load route handlers require('./src/routes')(app, config); // load middleware that should execute after route handlers require('./src/middleware/post-route-handling')(app, config); // load sdk; requires the app to allow clients to start the application const sdk = require('./src/lib/sdk')(app, config); module.exports = sdk;