forked from olegabu/fabric-starter-rest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
29 lines (23 loc) · 814 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const logger = require('log4js').getLogger('app');
const express = require('express');
const webAppManager = require('./web-app-manager');
const app = express();
const server = app.listen(process.env.PORT || 3000, () => {
logger.info('started fabric-starter rest server on port', server.address().port);
});
const api = require('./api');
api(app, server);
// serve
const glob = require('glob');
const path = require('path');
glob.sync('./routes/**/*.js').forEach(file => {
const route = require(path.resolve(file));
route(app);
logger.info('started route', file);
});
glob.sync('./webapps/*').forEach(dir => {
const appFolder = path.resolve(dir);
const context = path.basename(dir);
webAppManager.redeployWebapp(app, context, appFolder);
logger.info('static webapp', dir);
});