Created
August 15, 2020 04:58
-
-
Save myogeshchavan97/d1c2b1501acef546d1e0b83f166f3bee to your computer and use it in GitHub Desktop.
index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require("path"); | |
const express = require("express"); | |
const app = express(); // create express app | |
// add middlewares | |
app.use(express.static(path.join(__dirname, "..", "build"))); | |
app.use(express.static("public")); | |
app.use((req, res, next) => { | |
res.sendFile(path.join(__dirname, "..", "build", "index.html")); | |
}); | |
// start express server on port 5000 | |
app.listen(5000, () => { | |
console.log("server started on port 5000"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment