How to stub backend API calls with webpack-dev-server
devServer: {
setup: function(app) {
app.get('/some/path', function(req, res) {
res.json({ custom: 'response' });
});
},
}
When a request is emitted from the JS app to /some/path API URI, you get the custom response instead of HTTP 404 response
The 'setup' setting provides access to the Express web framework allowing server routes configuration