NuxtN
Nuxt12mo ago
4 replies
Hermes Alves

Hosting Nuxt 3 Server API on Cloudflare: Pages, Workers, or Neither?

I built a simple API in the server directory of my Nuxt 3 project. The structure looks like this:
// server/api/hello.ts
export default defineEventHandler((event) => {
  return {
    hello: 'world'
  }
})


Now, I want to host this project on Cloudflare. However, I'm unsure which Cloudflare service supports hosting Nuxt 3 server APIs:

Cloudflare Pages: Does it support server-side APIs like the one I built in Nuxt 3?

Cloudflare Workers: Would this be a better fit for hosting the server API?

Neither: Is there no support for Nuxt 3 server APIs on Cloudflare at all?

If anyone has experience with this setup or knows the best way to deploy a Nuxt 3 server API on Cloudflare, I'd appreciate the guidance!
Was this page helpful?