Skip to content

Instantly share code, notes, and snippets.

@varHarrie
Last active August 31, 2018 03:25
Show Gist options
  • Save varHarrie/2a41c665038b46ee1d18ff74474321eb to your computer and use it in GitHub Desktop.
Save varHarrie/2a41c665038b46ee1d18ff74474321eb to your computer and use it in GitHub Desktop.
const express = require('express')
const proxy = require('http-proxy-middleware')
const Bundler = require('parcel-bundler')
const bundlerOptions = { cache: false }
const proxyOptions = { target: 'http://localhost:3000' }
const app = express()
const bundler = new Bundler('src/index.html', bundlerOptions)
app.use('/api', proxy(proxyOptions))
app.use(bundler.middleware())
app.listen(Number(process.env.PORT || 1234))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment