-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
34 lines (25 loc) · 884 Bytes
/
app.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
'use strict';
const http = require('http');
const hostname = '127.0.0.1';
const port = 3333;
const cors = require('cors');
const express = require('express');
const app = express();
app.use(cors());
app.use(express.static('public'))
app.use(express.json());
app.use(express.urlencoded({extended: false}));
const server = http.createServer(app);
server.listen(port, hostname, () => {
console.log(`Server is running at ${hostname}:${port}`)
});
const rootController = require('./routes/index');
const itemController = require('./routes/items');
const orderController = require('./routes/orders');
const userController = require('./routes/users');
const quizController = require('./routes/quizzes');
app.use('/', rootController);
app.use('/items', itemController);
app.use('/orders', orderController);
app.use('/users', userController);
app.use('/quizzes', quizController);