webpack 4 & dev server

webpack 4 & dev server

proxyhtml

https://webpack.js.org/configuration/dev-server/#devserverproxywebpack

https://webpack.docschina.org/configuration/dev-server/#devservergit

// webpack.config.js

module.exports = {
  devServer: {
    proxy: {
      '/api': 'http://localhost:3000'
    }
  }
};

http-proxy

middlewaregithub

https://github.com/chimurai/http-proxy-middleware#tldrweb

var express = require('express');
var proxy = require('http-proxy-middleware');

var app = express();

app.use(
  '/api',
  proxy({ target: 'http://www.example.org', changeOrigin: true })
);
app.listen(3000);

// http://localhost:3000/api/foo/bar -> http://www.example.org/api/foo/bar


Chrome & CORS

Chrome & CORS & Fetch API & Chrome 多開,應用分身chrome

http://www.javashuo.com/article/p-owemzcrk-mq.htmlexpress

相關文章
相關標籤/搜索