angular 2 npm start - how to proxy API requests to another server? -
how can proxy ajax calls different server using npm start. npm start --proxy http://localhost:8080 doesn't work
i did ... 1 option add file:
bs-config.js
:
var proxymiddleware = require('http-proxy-middleware'); module.exports = { server: { middleware: { 1: proxymiddleware('/api', { target: 'http://localhost:8081/', changeorigin: true }) } } };
also run: npm install --save-dev http-proxy-middleware
Comments
Post a Comment