Skip to content

Instantly share code, notes, and snippets.

@eiriklv
Last active April 26, 2018 10:41
Show Gist options
  • Save eiriklv/f718084114f7b9852c056e970c3f1f6d to your computer and use it in GitHub Desktop.
Save eiriklv/f718084114f7b9852c056e970c3f1f6d to your computer and use it in GitHub Desktop.
Simple server
/**
* Dependencies
*/
const express = require('express');
const history = require('connect-history-api-fallback');
/**
* Environment / configuration
*/
const port = process.env.PORT || 3000;
/**
* Create our express app
*/
const app = express();
/**
* Use history fallback
*/
app.use(history());
/**
* Serve static files from the appropriate folder
*/
app.use(express.static(`${__dirname}/../../build`));
/**
* Attach server to port
*/
app.listen(port, () => {
console.log(`frontend-app listening to port ${port}`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment