-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
22 lines (17 loc) · 708 Bytes
/
server.js
File metadata and controls
22 lines (17 loc) · 708 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const express = require('express');
const bodyParser = require('body-parser');
const path = require('path');
const app = express();
const routes = require('./server/config/routes');
//****After running your build, uncomment this to launch the react fromtend with your node backend
// app.use(express.static(__dirname+ '/build'));
app.use(bodyParser.urlencoded({extended:true}));
app.use(bodyParser.json());
// Always return the main index.html, so react-router render the route in the client
// app.get('*', (req, res) => {
// res.sendFile(path.resolve(__dirname, 'build', 'index.html'));
// });
app.use(routes)
app.listen(3001, function () {
console.log('Example app listening on port 3001!');
});