-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
33 lines (23 loc) · 742 Bytes
/
Copy pathindex.js
File metadata and controls
33 lines (23 loc) · 742 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
const express = require('express');
const bodyParser = require('body-parser');
const morgan = require('morgan');
const cookieParser = require('cookie-parser');
let viewsRouter = require('./routes/views');
let api = require('./routes/api');
require('dotenv').config();
const app = express();
app.use(morgan('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use('/static', express.static('public'));
app.set('view engine', 'ejs');
app.use(express.static('public'));
app.use(cookieParser())
app.use('/', viewsRouter)
app.use('/api', api)
app.use('*', (req, res) => {
res.render('404')
});
app.listen(process.env.PORT, async() => {
console.log('listening app at', process.env.PORT)
});