|
|
|
@ -14,12 +14,14 @@ import * as Koa from 'koa';
|
|
|
|
|
import * as Router from 'koa-router'; |
|
|
|
|
import * as bodyParser from 'koa-bodyparser'; |
|
|
|
|
|
|
|
|
|
init(); |
|
|
|
|
|
|
|
|
|
async function init() { |
|
|
|
|
await convertPanelUrlToPanelId(); |
|
|
|
|
AnalyticsController.init(); |
|
|
|
|
ProcessService.registerExitHandler(AnalyticsController.terminate); |
|
|
|
|
convertPanelUrlToPanelId(); |
|
|
|
|
|
|
|
|
|
var app = new Koa(); |
|
|
|
|
const app = new Koa(); |
|
|
|
|
|
|
|
|
|
app.on('error', (err, ctx) => { |
|
|
|
|
console.log('got server error:'); |
|
|
|
@ -49,7 +51,7 @@ app.use(async function(ctx, next) {
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var rootRouter = new Router(); |
|
|
|
|
const rootRouter = new Router(); |
|
|
|
|
rootRouter.use('/analyticUnits', analyticUnitsRouter.routes(), analyticUnitsRouter.allowedMethods()); |
|
|
|
|
rootRouter.use('/segments', segmentsRouter.routes(), segmentsRouter.allowedMethods()); |
|
|
|
|
rootRouter.use('/threshold', thresholdRouter.routes(), thresholdRouter.allowedMethods()); |
|
|
|
@ -83,4 +85,4 @@ app
|
|
|
|
|
app.listen(HASTIC_PORT, () => { |
|
|
|
|
console.log(`Server is running on :${HASTIC_PORT}`); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|