Testing Nuxt 3 API Endpoints

Hi, I would like to test my Nuxt 3 server api endpoints. I know I could test it for example in postman or with playwright by making a real fetch request, but I would prefer to be able to mock the database calls and also spy on the functions called. As far as I know, this isn't possible when using postman or playwright? Are there any recommendations on how to properly test the api endpoints? Thank you in advance! Daniel
l422y13d ago
there's a few experimental config options for nitro that let you use swagger
l422y13d ago
Pooya Parsa  (@pi0) on X
experimental * /_nitro/scalar endpoint is available in https://t.co/poz4FHukDC and @nuxt_js nightly channels powered by @scalar! * you need to set nitro.experimental.openAPI: true
Thanks, @hanspagel for the initial PR ♥️
From An unknown user
l422y13d ago
depending on your nuxt version the uri will be /_nitro/swagger or /_nitro/scalar
danEE11d ago
Thank you for your help! 🙏
Want results from more Discord servers?
Add your server
More Posts