new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Nuxt · Getting started · all subjects

server & deployment

7 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Nuxt server is powered by Nitro

Nuxt's server is Nitro, an open-source HTTP framework originally created for Nuxt but now part of UnJS and available for use with other frameworks or standalone. Nitro uses h3 internally, a minimal HTTP framework built for high performance and portability.

Define server endpoints with defineEventHandler

Server endpoints and middleware can be defined in server/api directory using defineEventHandler from 'nitro/h3'. The handler function receives an event parameter and can return text, json, html, or a stream. Example: import { defineEventHandler } from 'nitro/h3'; export default defineEventHandler(async (event) => { // ... Do whatever you want here })

Server endpoints support hot module replacement and auto-import

Server endpoints and middleware in Nuxt support hot module replacement and auto-import out-of-the-box, just like other parts of the Nuxt application.

Nitro provides universal deployment to multiple providers

Nitro offers more than 15 presets to deploy Nuxt apps to different cloud providers and servers with start times of just a few milliseconds. Supported providers include Cloudflare Workers, Netlify Functions, and Vercel Cloud. Nuxt can also be deployed to other runtimes like Deno and Bun.

Configure route rules with routeRules in nuxt.config.ts

Use the routeRules property in nuxt.config.ts to customize how routes are rendered. Example configuration: routeRules: { '/': { prerender: true }, '/api/*': { cache: { maxAge: 60 * 60 } }, '/old-page': { redirect: { to: '/new-page', status: 302 } } }. Rules support prerender, cache with maxAge, and redirect with status properties.

Nuxt-specific route rules customize page rendering

Route rules like ssr, appMiddleware, and noScripts are Nuxt-specific and change behavior when rendering pages to HTML. Some route rules (appMiddleware, redirect, and prerender) also affect client-side behavior.

Hybrid rendering with Nitro routeRules

Nitro's routeRules feature enables hybrid rendering, allowing different routes to be rendered in different ways (prerendered, cached, server-rendered, etc.). Nitro is used to build the app for both server-side rendering and pre-rendering.

Give your agent this brain