Skip to content

Instantly share code, notes, and snippets.

@myogeshchavan97
Created August 15, 2020 04:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myogeshchavan97/d1c2b1501acef546d1e0b83f166f3bee to your computer and use it in GitHub Desktop.
Save myogeshchavan97/d1c2b1501acef546d1e0b83f166f3bee to your computer and use it in GitHub Desktop.
index.js
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