Skip to content

Instantly share code, notes, and snippets.

@nickdima
Created September 23, 2015 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickdima/e4b657d47f3693dd3313 to your computer and use it in GitHub Desktop.
Save nickdima/e4b657d47f3693dd3313 to your computer and use it in GitHub Desktop.
Express + Webpack Dev Server
if process.env.NODE_ENV is 'development'
app.all /(^\/(js|css)\/(.+))|(hot-update\.(.+)$)/, (req, res, next) ->
url = 'http://localhost:3001' + req.originalUrl
callback = (error, response, body) =>
if body?
res.writeHead response.statusCode, response.headers
res.end(body)
else
next()
request(url, callback)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment