-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
30 lines (24 loc) · 803 Bytes
/
server.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
const express = require('express');
const cookieParser = require('cookie-parser');
const config = require('config');
const cors = require('cors');
const postsRoute = require('./routes/posts');
const authRoute = require('./routes/users');
const assignmentsRoute = require('./routes/assignments');
const submissionsRoute = require('./routes/submissions');
const app = express();
app.use(cookieParser());
app.use(express.json());
app.use(cors({
origin: config.get('uiUrl'),
credentials: true
}));
app.use('/users', authRoute);
app.use('/posts', postsRoute);
app.use('/assignments', assignmentsRoute);
app.use('/submissions', submissionsRoute);
const PORT = config.get('port');
app.listen(PORT, () => {
// eslint-disable-next-line no-console
console.log(`Server running on PORT ${PORT}`);
});