framework
framework copied to clipboard
[Vue Router warn]: No match found when calling /api endpoint that doesn't exist
Environment
- Operating System:
Windows_NT
- Node Version:
v16.17.0
- Nuxt Version:
3.0.0-rc.9
- Nitro Version:
0.5.1
- Package Manager:
[email protected]
- Builder:
vite
- User Config:
-
- Runtime Modules:
-
- Build Modules:
-
Reproduction
https://stackblitz.com/edit/github-dyypbw
Describe the bug
Hi
while I was working on my project I got the following issue that I think it needs to be fixed
when calling a nitro api endpoint that doesn't exist it localhost:3000/api/nonexistingendpoint
this triggers Vue Router and recreate any nuxt server plugin
and i get this output:
[Vue Router warn]: No match found for location with path "/api/endpoint1"
NUXT PLUGIN
[Vue Router warn]: No match found for location with path "/api/endpoint1"
[Vue Router warn]: No match found for location with path "/api/endpoint1"
[Vue Router warn]: No match found for location with path "/api/endpoint1"
Additional context
No response
Logs
> npm run dev
Nuxi 3.0.0-rc.9 20:07:38
Nuxt 3.0.0-rc.9 with Nitro 0.5.1 20:07:39
20:07:42
> Local: http://localhost:3000/
> Network: http://192.168.1.104:3000/
ℹ Vite client warmed up in 2005ms 20:07:49
ℹ Vite server warmed up in 1388ms 20:07:50
✔ Nitro built in 3049 ms nitro 20:07:54
NUXT PLUGIN
NUXT PLUGIN
[Vue Router warn]: No match found for location with path "/api/endpoint1"
NUXT PLUGIN
[Vue Router warn]: No match found for location with path "/api/endpoint1"
[Vue Router warn]: No match found for location with path "/api/endpoint1"
[Vue Router warn]: No match found for location with path "/api/endpoint1"
[Vue Router warn]: No match found for location with path "/api/endpoint2"
NUXT PLUGIN
[Vue Router warn]: No match found for location with path "/api/endpoint2"
[Vue Router warn]: No match found for location with path "/api/endpoint2"
[Vue Router warn]: No match found for location with path "/api/endpoint2"
[Vue Router warn]: No match found for location with path "/api/endpoint3"
NUXT PLUGIN
[Vue Router warn]: No match found for location with path "/api/endpoint3"
[Vue Router warn]: No match found for location with path "/api/endpoint3"
[Vue Router warn]: No match found for location with path "/api/endpoint3"
If a route isn't found that matches a request, it 'falls through' to the Vue renderer. It would probably be okay to make /api/
a reserved prefix, but it is conceivable that a user might want to render a page for a route beginning with /api
.
that's understandable, but is it possible to add an option to the configuration to reserve some prefixes from falling through to the Vue renderer?