Created
July 21, 2020 07:53
-
-
Save xgenvn/04be5976d1884da77b0b11e8f6335a0a to your computer and use it in GitHub Desktop.
NUXT proxy
This file contains 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