vite: add mock api, return 404s
This commit is contained in:
parent
60521f224d
commit
d97602aa74
1 changed files with 13 additions and 0 deletions
|
@ -92,6 +92,19 @@ export default defineConfig(({ command }) => ({
|
|||
filename: 'report.html',
|
||||
title: 'Soapbox Bundle',
|
||||
}),
|
||||
{
|
||||
name: 'mock-api',
|
||||
configureServer(server) {
|
||||
server.middlewares.use((req, res, next) => {
|
||||
if (/^\/api\//.test(req.url!)) {
|
||||
res.statusCode = 404;
|
||||
res.end('Not Found');
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
],
|
||||
resolve: {
|
||||
alias: [
|
||||
|
|
Loading…
Reference in a new issue