-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
28 lines (20 loc) · 664 Bytes
/
Copy pathindex.js
File metadata and controls
28 lines (20 loc) · 664 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
const express = require("express");
const path = require("path");
var morgan = require("morgan");
const app = express();
app.use(
morgan(":method :url :status :response-time ms - :res[content-length]")
);
// Serve static files from the React app
app.use(express.static(path.join(__dirname, "./build")));
app.use(express.static(path.join(__dirname, "./build/static/css")));
app.get("/", (req, res) => {
res.sendFile(path.join(__dirname + "/build/index.html"));
});
app.get('*', function(req, res){
res.send('dont even try :)', 404);
});
const port = process.env.PORT || 4000;
app.listen(port, () => {
console.log(`Server listening on ${port}`);
});