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

migration/server

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.

Remove render key from nuxt.config in migration

When migrating from Nuxt 2 to Nuxt 3, remove the render key in your nuxt.config.

Update serverMiddleware array to use files or npm packages directly

When migrating from Nuxt 2 to Nuxt 3, update any other items in your serverMiddleware array to point to files or npm packages directly, rather than using inline functions.

Migration from Nuxt 2: rename head to meta in nuxt.config

When migrating from Nuxt 2 to Nuxt 3, rename the 'head' key to 'meta' in your nuxt.config. Consider moving shared meta configuration into your app.vue instead. Objects no longer have a 'hid' key for deduplication.

Migration from Nuxt 2 head() to useHead composable

If you need to access component state with the head() method in Nuxt 2, you should migrate to using the useHead composable in Nuxt 3, which supports reactive state. Alternatively, you can use meta components.

Nitro v3 package and import path changes

The `nitropack` package has been renamed to `nitro`. Import paths changed: `nitropack` → `nitro`, `nitropack/types` → `nitro/types`, `nitropack/runtime` → `nitro`, `h3` (for server utilities) → `nitro/h3`. Auto-imports within server routes continue to work without changes. For explicit imports update from `import { defineEventHandler } from 'h3'` to `import { defineEventHandler } from 'nitro/h3'`. For module authors, type augmentations must target `declare module 'nitro/types'` instead of `nitropack/types`.

H3Event Web standard API changes in Nitro v3

The `H3Event` object now uses Web standard APIs. Request properties: `event.path` (string) → `event.url.pathname` (URL object with .pathname, .search, .hash), `event.method` → `event.req.method` (via Web Request), `event.node.req.headers` (Node.js) → `event.req.headers` (Web Headers API with .get(), .set(), .has()). Response properties: `event.node.res.statusCode = 200` → `event.res.status = 200`, `event.node.res.statusMessage = 'OK'` → `event.res.statusText = 'OK'`, `setResponseHeader(event, 'x-custom', 'value')` → `event.res.headers.set('x-custom', 'value')`, `appendResponseHeader(event, 'set-cookie', cookie)` → `event.res.headers.append('set-cookie', cookie)`.

Nitro v3 module author changes

In Nitro v3, use `import { definePlugin } from 'nitro'` for explicit imports of Nitro plugins (auto-imports still work). Runtime hooks changed: `nitroApp.hooks.hook('beforeResponse', ...)` and `nitroApp.hooks.hook('afterResponse', ...)` replaced by `nitroApp.hooks.hook('response', ...)`. `getRouteRules()` helper changed from `getRouteRules(event)` to `getRouteRules(method, pathname)` which returns `{ routeRules }`.

Give your agent this brain