-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
35 lines (24 loc) · 791 Bytes
/
app.js
File metadata and controls
35 lines (24 loc) · 791 Bytes
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
'use strict';
var SwaggerExpress = require('swagger-express-mw');
const express = require('express');
const schedule = require('node-schedule');
const Cron = require('./api/helpers/Cron.js');
var app = express();
module.exports = app; // for testing
var config = {
appRoot: __dirname // required config
};
// Host Swagger-UI
app.use('/docs', express.static('docs'));
SwaggerExpress.create(config, function (err, swaggerExpress) {
if (err) {
throw err;
}
// install middleware
swaggerExpress.register(app);
var port = process.env.PORT || 8080;
console.log("Slackbot service API running at http://localhost:" + port);
app.listen(port);
});
var checkFrequency = 1; //1 minutes
schedule.scheduleJob(`*/${checkFrequency} * * * *`, Cron.runJob);