Skip to content

Instantly share code, notes, and snippets.

@gate5th gate5th/app.js
Last active Sep 17, 2018

Embed
What would you like to do?
oldschoolshuffle
//app.js in your ROOT directory
const express = require("express");
const path = require("path");
const app = express();
// Serve static files from the React app
app.use(express.static(path.join(__dirname, "build")));
// The "catchall" handler: for any request that doesn't
// match one above, send back React's index.html file.
app.get("*", (req, res) => {
res.sendFile(path.join(__dirname, "build", "index.html"));
});
const port = process.env.PORT || 3000;
app.listen(port);
console.log(`Old School Shuffle running in production on port ${port}`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.