mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 02:14:01 +00:00
Test development and built-preview route registration, preserve development-only credential editing, and document local preview configuration.
18 lines
508 B
JavaScript
18 lines
508 B
JavaScript
/** Finish unmatched API requests before Vite's HTML fallback. Install last. */
|
|
export function apiNotFoundPlugin() {
|
|
const install = (server) => {
|
|
server.middlewares.use('/api', (_req, res) => {
|
|
res.writeHead(404, {
|
|
'Content-Type': 'application/json',
|
|
'Cache-Control': 'no-store',
|
|
});
|
|
res.end(JSON.stringify({ error: 'Unknown API route' }));
|
|
});
|
|
};
|
|
return {
|
|
name: 'api-not-found',
|
|
configureServer: install,
|
|
configurePreviewServer: install,
|
|
};
|
|
}
|