docs(getting-started): add schema for server

This commit is contained in:
Sébastien Chopin 2023-10-20 19:28:55 +02:00
parent 3eef1b3406
commit 6d0f45469e

View File

@ -10,7 +10,9 @@ Nuxt's server framework allows you to build **full-stack applications**. For exa
## Powered by Nitro
Nuxt's server is [Nitro](https://github.com/unjs/nitro). Nitro was originally created for Nuxt but is now part of [UnJS](https://unjs.io) and used for other frameworks - and can even be used on its own.
![Server engine](/assets/docs/getting-started/server.svg)
Nuxt's server is [Nitro](https://github.com/unjs/nitro). It was originally created for Nuxt but is now part of [UnJS](https://unjs.io) and open for other frameworks - and can even be used on its own.
Using Nitro gives Nuxt superpowers:
@ -18,9 +20,11 @@ Using Nitro gives Nuxt superpowers:
- Universal deployment on any provider (many zero-config)
- Hybrid rendering
## Full control of the server-side part of your app
Nitro is internally using [h3](https://github.com/unjs/h3), a minimal H(TTP) framework built for high performance and portability.
With Nitro, you can easily manage the server part of your Nuxt app, from API endpoints to middleware.
## Server Endpoints & Middleware
You can easily manage the server-only part of your Nuxt app, from API endpoints to middleware.
Both endpoints and middleware can be defined like this:
@ -32,7 +36,7 @@ export default defineEventHandler(async (event) => {
And you can directly return `text`, `json`, `html` or even a `stream`.
Out-of-the-box, Nitro supports **hot module replacement** and **auto-import** like the other parts of your Nuxt application.
Out-of-the-box, it supports **hot module replacement** and **auto-import** like the other parts of your Nuxt application.
:read-more{to="/docs/guide/directory-structure/server"}
@ -42,7 +46,7 @@ Nitro offers the ability to deploy your Nuxt app anywhere, from a bare metal ser
:read-more{to="/blog/nuxt-on-the-edge"}
Today, Nitro offers more than 15 presets to build your Nuxt app for different cloud providers and servers, including:
There are more than 15 presets to build your Nuxt app for different cloud providers and servers, including:
- [Cloudflare Workers](https://workers.cloudflare.com)
- [Netlify Functions](https://www.netlify.com/products/functions)
@ -60,8 +64,6 @@ Or for other runtimes:
## Hybrid Rendering
Do you need both static and dynamic pages in your Nuxt app? Nitro has your back!
Nitro has a powerful feature called `routeRules` which allows you to define a set of rules to customize how each route of your Nuxt app is rendered (and more).
```ts [nuxt.config.ts]
@ -84,7 +86,7 @@ export default defineNuxtConfig({
Learn about all available route rules are available to customize the rendering mode of your routes.
::
In addition, there are some route rules (for example, `ssr` and `experimentalNoScripts`) that are not Nuxt specific to change the behavior when rendering your pages to HTML.
In addition, there are some route rules (for example, `ssr` and `experimentalNoScripts`) that are Nuxt specific to change the behavior when rendering your pages to HTML.
Some route rules (`redirect` and `prerender`) also affect client-side behavior.