Skip to content

Instantly share code, notes, and snippets.

@ryanflorence
Created December 2, 2015 17:05
Show Gist options
  • Save ryanflorence/0878a4339a423b13cc69 to your computer and use it in GitHub Desktop.
Save ryanflorence/0878a4339a423b13cc69 to your computer and use it in GitHub Desktop.
/*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