Created
December 2, 2015 17:05
-
-
Save ryanflorence/0878a4339a423b13cc69 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*eslint-disable no-console, no-var */ | |
import express from 'express' | |
import webpack from 'webpack' | |
import webpackDevMiddleware from 'webpack-dev-middleware' | |
import WebpackConfig from './webpack.config' | |
import path from 'path' | |
const app = express() | |
if (process.env.NODE_ENV === 'development') { | |
app.use(webpackDevMiddleware(webpack(WebpackConfig), { | |
publicPath: '/__build__/', | |
stats: { colors: true } | |
})) | |
} | |
app.use(express.static(__dirname)) | |
app.get('*', (req, res) => { | |
res.sendFile(path.join(__dirname, 'index.html')) | |
}) | |
app.listen(8080, () => { | |
console.log('Server listening on http://localhost:8080, Ctrl+C to stop') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment