mirror of
https://github.com/withastro/astro.git
synced 2024-12-23 21:53:55 -05:00
80034c6cbc
* Netlify adapter * Remove package.json export that doesnt exist * Fix out path * Make netlifyFunctions the default * Make the dist configurable * Add an export for the functions * Append of the file exists
44 lines
963 B
Markdown
44 lines
963 B
Markdown
# @astrojs/netlify
|
|
|
|
Deploy your server-side rendered (SSR) Astro app to [Netlify](https://www.netlify.com/).
|
|
|
|
Use this adapter in your Astro configuration file:
|
|
|
|
```js
|
|
import { defineConfig } from 'astro/config';
|
|
import netlify from '@astrojs/netlify/functions';
|
|
|
|
export default defineConfig({
|
|
adapter: netlify()
|
|
});
|
|
```
|
|
|
|
After you build your site the `netlify/` folder will contain [Netlify Functions](https://docs.netlify.com/functions/overview/) in the `netlify/functions/` folder.
|
|
|
|
Now you can deploy!
|
|
|
|
```shell
|
|
netlify deploy
|
|
```
|
|
|
|
## Configuration
|
|
|
|
The output folder is configuration with the `dist` property when creating the adapter.
|
|
|
|
```js
|
|
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`:
|
|
|
|
```toml
|
|
[functions]
|
|
directory = "dist/functions"
|
|
```
|