-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
35 lines (31 loc) · 1007 Bytes
/
index.js
File metadata and controls
35 lines (31 loc) · 1007 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
35
const express = require('express');
const app = express();
const mongoose = require('mongoose');
const bodyParser = require('body-parser');
const router = require('./router');
const cors = require('cors');
const cookieParser = require('cookie-parser');
const config = require('./config.json');
const socket = require('./socket')
mongoose.Promise = global.Promise;
const conn = mongoose.connect(config.db);
mongoose.connection.once('connected', function() {
console.log("Connected to database")
});
app.use(bodyParser.json());
app.use(cookieParser());
app.use(cors());
router(app);
const server = app.listen(config.port);
socket(server)
console.log(process.argv)
if (process.argv[2] && process.argv[2] == 'populateTasks') {
console.log('Populating tasks...')
require('./populateTasks')
} else if (process.argv[2] === 'populateS') {
console.log('Populating scenarios...')
require('./populateS')
} else if (process.argv[2]) {
console.log('Populating equipment...')
require('./populateEquipments')
}