0Pricing
Vue Academy · Lesson

Nuxt Server Routes and API Endpoints

server/api/ directory, defineEventHandler(), H3 utilities, middleware, error handling.

Nuxt Is Full-Stack

Nuxt 3 includes a server engine (Nitro). The server/ directory lets you build API endpoints alongside your pages — no separate backend needed for many apps.

The server/api Directory

Files in server/api/ become API routes under /api. server/api/hello.ts responds at /api/hello.

server/
  api/
    hello.ts   ->  /api/hello
    posts.ts   ->  /api/posts

All lessons in this course

  1. Nuxt 3 Project Structure and File-Based Routing
  2. Data Fetching: useFetch and useAsyncData
  3. Nuxt Server Routes and API Endpoints
  4. SSR vs SSG vs SPA Mode
← Back to Vue Academy