mirror of
https://github.com/withastro/astro.git
synced 2024-12-23 21:53:55 -05:00
77aa3a5c50
* feat: human-readable error on bad site or base * fix: human-readable error should have 1 config option * docs: update README * chore: changeset * docs: mention localhost for testing via netlify CLI
1.2 KiB
1.2 KiB
@astrojs/netlify
Deploy your server-side rendered (SSR) Astro app to Netlify.
Use this adapter in your Astro configuration file, alongside a valid deployment URL:
import { defineConfig } from 'astro/config';
import netlify from '@astrojs/netlify/functions';
export default defineConfig({
adapter: netlify(),
// Where your Netlify app will be deployed.
// Feel free to use a local URL (i.e. http://localhost:8080)
// to test local builds via the netlify CLI
site: 'https://my-production-url.netlify.app',
});
After you build your site the netlify/
folder will contain Netlify Functions in the netlify/functions/
folder.
Now you can deploy!
netlify deploy
Configuration
dist
We build to a netlify
directory at the base of your project. To change this, use the dist
option:
import { defineConfig } from 'astro/config';
import netlify from '@astrojs/netlify/functions';
export default defineConfig({
adapter: netlify({
dist: new URL('./dist/', import.meta.url)
})
});
And then point to the dist in your netlify.toml
:
[functions]
directory = "dist/functions"