astro/packages/integrations/netlify
2022-04-06 20:22:36 +00:00
..
src [ci] format 2022-04-06 20:22:36 +00:00
test [ci] format 2022-04-06 20:22:36 +00:00
CHANGELOG.md [ci] format 2022-04-05 19:29:23 +00:00
package.json Fix Netlify adapter and dynamic routes (#3011) 2022-04-06 16:21:46 -04:00
readme.md Docs: netlify adapter site requirement (#2996) 2022-04-05 11:25:48 -04:00
tsconfig.json Netlify adapter (#2879) 2022-03-25 12:08:02 -04:00

@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"