Server Engine
This engine has many benefits:
Cross-platform support for Node.js, Browsers, service-workers and more.
Serverless support out-of-the-box.
API routes support.
Automatic code-splitting and async-loaded chunks.
Hybrid mode for static + serverless sites.
Development server with hot module reloading.
Key features include:
- Handlers can directly return objects/arrays for an automatically-handled JSON response
- Helper functions for body parsing, cookie handling, redirects, headers and more
Check out the h3 docs for more information.
ℹ️
Learn more about the API layer in the directory.
Nitro allows ‘direct’ calling of routes via the globally-available $fetch
helper. This will make an API call to the server if run on the browser, but will directly call the relevant function if run on the server, saving an additional API call.
$fetch
API is using ohmyfetch, with key features including:
- Automatic parsing of JSON responses (with access to raw response if needed)
For more information on $fetch
features, check out .
You can access these types when using $fetch()
or .
Nitro produces a standalone server dist that is independent of node_modules
.
The server in Nuxt 2 is not standalone and requires part of Nuxt core to be involved by running nuxt start
(with the nuxt-start or distributions) or custom programmatic usage, which is fragile and prone to breakage and not suitable for serverless and service-worker environments.
Nuxt 3 generates this dist when running nuxt build
into a .output directory.
The output contains runtime code to run your Nuxt server in any environment (including experimental browser service workers!) and serve your static files, making it a true hybrid framework for the JAMstack. In addition, Nuxt implements a native storage layer, supporting multi-source drivers and local assets.
Check out the Nitro engine on GitHub: .