Skip to content

Instantly share code, notes, and snippets.

@eiriklv
Last active Apr 26, 2018
Embed
What would you like to do?
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