-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
23 lines (20 loc) · 659 Bytes
/
Copy pathwebpack.config.js
File metadata and controls
23 lines (20 loc) · 659 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const bikes = require("./mock-api-responses/bikes.json");
const cars = require("./mock-api-responses/cars.json");
module.exports = {
devServer: {
setupMiddlewares: (middlewares, devServer) => {
if (!devServer) {
throw new Error("webpack-dev-server is not defined");
}
// see middleware configuration examples at
// https://github.com/webpack/webpack-dev-server/issues/4129
devServer.app.get("/api/cars", (request, response) => {
response.json(cars);
});
devServer.app.get("/api/bikes", (request, response) => {
response.json(bikes);
});
return middlewares;
},
},
};