FullstackReactCode
FullstackReactCode copied to clipboard
Proxy
The way of adding proxys has changed. It no longer has to be added to package.json, but to a file named setupProxy.js inside src of client. Also, 'http-proxy-middleware' has to be installed.
Code inside setupProxy would look like this -
const proxy = require('http-proxy-middleware')
module.exports = function(app) {
app.use(proxy('/auth/google', { target: 'http://localhost:5000/' }))
app.use(proxy('/api/*', { target: 'http://localhost:5000/' }))
}
thank you very much, but do i need to require the file and can you show how file is to be required
Requiring the setupProxy.js file isn't necessary.