Skip to content

Instantly share code, notes, and snippets.

@jasonmccallister
Created April 22, 2019 12:44
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 jasonmccallister/8e425ef13d7153bf7c5f9ed514037e19 to your computer and use it in GitHub Desktop.
Save jasonmccallister/8e425ef13d7153bf7c5f9ed514037e19 to your computer and use it in GitHub Desktop.
NuxtJS server middleware proxy pass example
const httpProxy = require('http-proxy')
const proxy = httpProxy.createProxyServer()
const API_URL = process.env.API_URL || 'https://api.mydomain.com'
export default function(req, res, next) {
proxy.web(req, res, {
target: API_URL
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment