-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathserver.js
31 lines (24 loc) · 863 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
31
/* eslint-disable no-console */
const express = require('express');
const morgan = require('morgan'); // http request templating agent
const bodyParser = require('body-parser');
const cors = require('cors');
const app = express();
const config = require('./app/config');
app.use(cors());
app.use(bodyParser.json({ limit: '50mb' }));
app.use(bodyParser.urlencoded({ limit: '50mb', extended: true }));
app.use(express.static('public'));
app.use(morgan('dev'));
const { routes } = require('./app');
app.get('/', (req, res) => {
res.send('<h1>Enter appropriate API</h1>');
});
app.use('/api', routes.main);
app.use('/api/admin', routes.admin);
app.use('/api/student', routes.students);
app.use('/api/staff', routes.staff);
app.use('/api/lecturer', routes.lecturer);
app.listen(config.port, () => {
console.log(`Server is listening on ${config.port}`);
});