generated from openBackhaul/ApplicationOwnerRepositoryTemplate
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
47 lines (37 loc) · 1.69 KB
/
index.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const cp = require('./service/individualServices/CyclicProcessService/cyclicProcess');
'use strict';
var path = require('path');
var http = require('http');
//var oas3Tools = require('openbackhaul-oas3-tools');
var oas3Tools = require('oas3-tools');
var serverPort = 8080;
const prepareElasticsearch = require('./service/individualServices/ElasticsearchPreparation');
var appCommons = require('onf-core-model-ap/applicationPattern/commons/AppCommons');
// uncomment if you do not want to validate security e.g. operation-key, basic auth, etc
//appCommons.openApiValidatorOptions.validateSecurity = false;
// swaggerRouter configuration
var options = {
routing: {
controllers: path.join(__dirname, './controllers')
},
openApiValidator: appCommons.openApiValidatorOptions
};
var expressAppConfig = oas3Tools.expressAppConfig(path.join(__dirname, 'api/openapi.yaml'), options);
var app = expressAppConfig.getApp();
appCommons.setupExpressApp(app);
//TO REMOVE, ONLY FOR DEBUG
//global.databasePath = 'D:/\VALE/\WorkindDoc/\MICROSERVIZI/\loadjson/\loadMATRRunning.json'
global.databasePath = './database/load.json'
prepareElasticsearch().catch(err => {
console.error(`Error preparing Elasticsearch : ${err}`);
}).finally(
() => {
// Initialize the Swagger middleware
http.createServer(app).listen(serverPort, function () {
console.log('Your server is listening on port %d (http://localhost:%d)', serverPort, serverPort);
console.log('Swagger-ui is available on http://localhost:%d/docs', serverPort);
});
appCommons.performApplicationRegistration();
//cp.embeddingCausesCyclicRequestsForUpdatingMacTableFromDeviceAtMatr(2);
}
);