Node.js server

    Default preset if none is specified or auto-detected

    Node.js server (default) - 图2 Loads only the required chunks to render the request for optimal cold start timing

    Useful for debugging

    Back to presets list.

    You can use the to explicitly set the preset to use:

    nuxt.config.js|ts

    1. NITRO_PRESET=server npx nuxt build

    When running nuxt build with the Node server preset, the result will be an entry point that launches a ready-to-run Node server.

    1. Listening on http://localhost:3000

    This preset will respect the following runtime environment variables:

    • NUXT_PORT or PORT (defaults to )
    • NUXT_HOST or HOST (defaults to 'localhost')
    • NITRO_SSL_CERT and NITRO_SSL_KEY - if both are present, this will launch the server in HTTPS mode. In the vast majority of cases, this should not be used other than for testing, and the Nitro server should be run behind a reverse proxy like nginx or Cloudflare which terminates SSL.

    You can enable the nitro.timing option to have the logs about the chunk loading and cold start performance.

    1. $ node .output/server/index.mjs
    2. > Load chunks/nitro/static (0ms)
    3. > Load chunks/app/render (1ms)
    4. > Load chunks/app/client.manifest (0ms)
    5. > Load chunks/index (3ms)
    6. > Load chunks/app/server (2ms)
    7. > Load chunks/app/vue3 (0ms)