-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
34 lines (26 loc) · 854 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
const express = require('express')
const bodyParser = require('body-parser')
const cors = require('cors')
const app = express();
const port = process.env.PORT || 8090;
app.use(express.json());
app.use(express.urlencoded({ extended: true }))
app.use(bodyParser.urlencoded({ extended: true }));
app.use(cors({
origin: '*',
credentials: true,
}));
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization");
res.header("Access-Control-Allow-Credentials", true);
next();
});
app.use(express.static('./static'));
app.set("view engine", "pug");
app.get("/", (req, res) => {
return res.render('main', {})
});
app.listen(port, () => {
console.log(`Application is up and running under localhost:${port}`)
})