@astro-aws/适应器
一个 天体 用于构建SSR应用程序并将其部署到AWS Lambda的适配器.
兼容性
要求数 天体6+ 财务报告和审定财务报表 节点.js 22+。 。 。 .
安装
# Using NPM
npx astro add @astro-aws/adapter
# Using Yarn
yarn astro add @astro-aws/adapter
# Using PNPM
pnpm astro add @astro-aws/adapter
# Using Bun
bun x astro add @astro-aws/adapter
手动
- 安装软件包 .
# Using NPM
npm install -D @astro-aws/adapter
# Using Yarn
yarn add -D @astro-aws/adapter
# Using PNPM
pnpm add -D @astro-aws/adapter
# Using Bun
bun add -D @astro-aws/adapter
- 在您的
astro.config.mjs文档.
import { defineConfig } from "astro/config"
import astroAws from "@astro-aws/adapter"
export default defineConfig({
output: "server",
adapter: astroAws(),
})
SSR的使用
- 安装软件包 .
# Using NPM
npm install -D @astro-aws/adapter
# Using Yarn
yarn add -D @astro-aws/adapter
# Using PNPM
pnpm add -D @astro-aws/adapter
# Using Bun
bun add -D @astro-aws/adapter
- 在您的
astro.config.mjs文档.
import { defineConfig } from "astro/config"
import astroAws from "@astro-aws/adapter"
export default defineConfig({
output: "server",
adapter: astroAws({
mode: "ssr",
}),
})
SSR 流用法
- 安装软件包 .
# Using NPM
npm install -D @astro-aws/adapter
# Using Yarn
yarn add -D @astro-aws/adapter
# Using PNPM
pnpm add -D @astro-aws/adapter
# Using Bun
bun add -D @astro-aws/adapter
- 在您的
astro.config.mjs文档.
import { defineConfig } from "astro/config"
import astroAws from "@astro-aws/adapter"
export default defineConfig({
output: "server",
adapter: astroAws({
mode: "ssr-stream",
}),
})
边用法
- 安装软件包 .
# Using NPM
npm install -D @astro-aws/adapter
# Using Yarn
yarn add -D @astro-aws/adapter
# Using PNPM
pnpm add -D @astro-aws/adapter
# Using Bun
bun add -D @astro-aws/adapter
- 在您的
astro.config.mjs文档.
import { defineConfig } from "astro/config"
import astroAws from "@astro-aws/adapter"
export default defineConfig({
output: "server",
adapter: astroAws({
mode: "edge",
}),
})
限制
- 不支持环境变量
- 执行时间有限(观看者请求/答复5秒,来源请求/答复30秒)
- 较小的部署包大小限制
- 获得AWS服务的机会有限(无VPC访问)
- 无法访问文件系统( 但除外)
/tmp(中文(简体) )
示例
见 此站点的源代码