...

/

File Based API Routes

File Based API Routes

Learn how we can set up API routes with Nuxt.

The Pixabay API had a base URL of https://pixabay.com/api/. We can add parameters to the end, such as: https://pixabay.com/api/?key=${apiKey}&q=sea

The URL string was how we made requests for the image data we wanted, but how could we handle this with our own Nuxt API? The answer lies in the file-based API routes.

File-based API routes

Once it is completed, we can link our server application to a URL to give us the base URL. The base URL is then extended depending on the type of API we want to build. If we were creating an e-commerce API, we may have URLs such as: ...