If you are using Nuxt 3 you might stumble upon one of the following tools: Nitro, h3 or ofetch. I often see that people are confused by these tools, so let me clarify their responsibility and how Nuxt uses them internally.
All of the following packages are published in the UnJS ecosystem. The philosophy is
A robust ecosystem, driven by the UNIX Philosophy, housing purpose-built, high-quality JavaScript utilities, libraries, and tools, upheld by a collaborative community.
The ecosystem provides 56+ packages.
Nuxt provides access to ofetch via the $fetch API. Its described as
A better fetch API. Works on node, browser, and workers.
Some of its key features:
Content-Type headers.h3 is an H(TTP) server framework built for high performance and portability running in any JavaScript runtime.
Some of its key features:
application/json Content-Type header.Promise, h3 will wait for it before it sends the response.Nitro uses h3 internally and is a server toolkit to create web servers with everything you need and deploy them wherever you prefer.
Some of its key features:
Nitro powers the server API endpoints and middleware in Nuxt 3.
If you liked this Vue tip, follow me on Twitter to get notified about new tips, blog posts, and more. Alternatively (or additionally), you can subscribe to my weekly Vue & Nuxt newsletter :
Vue Tip: Validate Props in Script Setup With TypeScript
Vue Tip: Don't Use Reactive Object for Template Refs
