-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
37 lines (31 loc) · 994 Bytes
/
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
var express = require('express');
var path = require('path');
var formidable = require('express-formidable');
var session = require('express-session');
var cors = require('cors');
var db = require('./db/db');
var Sequelize = require('sequelize');
var config = require('./config');
var logger = require('./utils/logger')("Express");
var app = express();
db.init();
app.use('/service/rc', express.static(__dirname + '/rc'));
app.use(express.static('.'));
app.use(formidable());
app.use(cors());
app.use(session({
secret: config.secret,
resave: false,
saveUninitialized: false,
cookie: {
secure: 'auto',
httpOnly: true,
maxAge: 24*60*60*1000 // expires in 1 day
}
}));
app.use('/service/rc', require('./routes/rc'));
app.use('/service/project', require('./routes/project'));
app.use('/service/auth', require('./routes/auth'));
app.listen(config.serverPort, ()=>{
logger.info("Serving ScratchTalk Subsystem on PORT %d", config.serverPort);
});