How can I find the endpoint URLs after the Nuxt 3 server directory is deployed as a netlify function?

Hello there,

First of all the site name: https://spectacular-faloodeh-9e374b.netlify.app.

I have written an endpoint in my Nuxt 3 app in the server directory that I want to call with a webhook.
I have written only one function, therefore my server directory structure looks like this: server/api/ping.ts

When I deploy the Nuxt app to Netlify, it makes it appear that all endpoints are deployed to a single function called “server”.

Netlify exposed the server directory at the following URL: https://spectacular-faloodeh-9e374b.netlify.app/.netlify/functions/server

I assumed that my function endpoint might be found at the following URL: .netlify/functions/server/api/ping

But when I try to call those URLs with with Postman, I get a 404 Not Found status back and I get this warning in the functions console:

Jun 8, 05:16:03 PM: 3f0b79a0 WARN   [Vue Router warn]: No match found for location with path "/.netlify/functions/server"
Jun 8, 05:16:03 PM: 3f0b79a0 WARN   [Vue Router warn]: No match found for location with path "/.netlify/functions/server/api/ping"

When I try to call “classic” Netlify functions this way, everything works beautifully because each function has its own entry and the endpoint URLs target the functions directly.

So the big questions I ask myself are:

  • How do I find out the correct routes for the endpoints if I use the server directory instead of the Netlify functions?
  • Is that even possible?

I dont know what I’m missing.

Thank you and best regards
Ben


More about the server directory in nuxt:

You just need to use /api/<slug>.

1 Like

Oh okay, that makes sense… :smiley: thanks!

glad this helped you solve your issue!