Created
April 22, 2019 12:44
-
-
Save jasonmccallister/8e425ef13d7153bf7c5f9ed514037e19 to your computer and use it in GitHub Desktop.
NuxtJS server middleware proxy pass example
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
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