forked from Adrianjewell91/all-clear-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
34 lines (29 loc) · 869 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
const express = require('express');
// const session = require('express-session');
const path = require('path')
const bodyParser = require('body-parser');
const app = express();
//
// app.set('view engine', 'ejs');
// app.set('views', __dirname + '/views');
// Use the session middleware
app.use(express.static('frontend'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
//
// app.use(session({
// secret: 'YOURSECRET',
// resave: false,
// saveUninitialized: true,
// cookie: {
// maxAge: 30 * 60 * 1000
// }
// }));
app.get('/', async (req, res) => {
res.sendFile(path.join(__dirname, '/frontend/react_index.html'));
});
// Run local server on port 3000.
const port = process.env.PORT || 3000;
const server = app.listen(port, function () {
console.log('Server running at http://127.0.0.1:' + port + '/');
});