e55af8a232
* wip * Deprecate buildConfig and move to config.build * Implement the standalone server * Stay backwards compat * Add changesets * correctly merge URLs * Get config earlier * update node tests * Return the preview server * update remaining tests * swap usage and config ordering * Update packages/astro/src/@types/astro.ts Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Update .changeset/metal-pumas-walk.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Update .changeset/metal-pumas-walk.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Update .changeset/stupid-points-refuse.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Update .changeset/stupid-points-refuse.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Link to build.server config Co-authored-by: Fred K. Schott <fkschott@gmail.com> Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
1.2 KiB
1.2 KiB
@astrojs/node |
---|
major |
Standalone mode for the Node.js adapter
New in @astrojs/node
is support for standalone mode. With standalone mode you can start your production server without needing to write any server JavaScript yourself. The server starts simply by running the script like so:
node ./dist/server/entry.mjs
To enable standalone mode, set the new mode
to 'standalone'
option in your Astro config:
import { defineConfig } from 'astro/config';
import nodejs from '@astrojs/node';
export default defineConfig({
output: 'server',
adapter: nodejs({
mode: 'standalone'
})
});
See the @astrojs/node documentation to learn all of the options available in standalone mode.
Breaking change
This is a semver major change because the new mode
option is required. Existing @astrojs/node users who are using their own HTTP server framework such as Express can upgrade by setting the mode
option to 'middleware'
in order to build to a middleware mode, which is the same behavior and API as before.
import { defineConfig } from 'astro/config';
import nodejs from '@astrojs/node';
export default defineConfig({
output: 'server',
adapter: nodejs({
mode: 'middleware'
})
});