Skip to content

Instantly share code, notes, and snippets.

@velopert velopert/index.js Secret
Last active Jan 15, 2017

What would you like to do?
const express = require('express');
const app = express();
const path = require('path');
app.use('/', express.static(path.resolve(__dirname, '../build')));
app.get('*', (req, res, next) => {
if(req.path.split('/')[1] === 'static') return next();
res.sendFile(path.resolve(__dirname, '../build/index.html'));
app.listen(4000, function () {
console.log('Example app listening on port 4000!');
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.