-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
35 lines (25 loc) · 792 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
34
35
const express = require('express');
const bodyParser = require('body-parser');
const locationRoutes = require('./routes/location');
const app = express();
// app.set('view engine', 'ejs');
// app.set('views', 'views');
app.use(bodyParser.json());
app.use((req, res, next) => {
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Methods', 'POST, GET, OPTIONS');
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
next();
});
app.use(locationRoutes);
// app.use((req, res, next) => {
// res.setHeader('Content-Type', 'text/html');
// next();
// });
// app.use((req, res, next) => {
// const userName = req.body.username || 'Unknown User';
// res.render('index', {
// user: userName
// });
// });
app.listen(3000);