Skip to content

Instantly share code, notes, and snippets.

@bishesh16
Created May 28, 2018 20:45
Show Gist options
  • Save bishesh16/86b7eb57fffb7e7c379ad79bbddaa4fa to your computer and use it in GitHub Desktop.
Save bishesh16/86b7eb57fffb7e7c379ad79bbddaa4fa to your computer and use it in GitHub Desktop.
var path = require("path"),
express = require("express");
var DIST_DIR = path.join(__dirname, "dist"),
PORT = 3000,
app = express();
//Serving the files on the dist folder
app.use(express.static(DIST_DIR));
//Send index.html when the user access the web
app.get("*", function (req, res) {
res.sendFile(path.join(DIST_DIR, "index.html"));
});
app.listen(PORT);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment