mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-06 04:22:01 +00:00
examples: Update Astro template. (#11687)
This commit is contained in:
5
.changeset/brave-knives-stare.md
Normal file
5
.changeset/brave-knives-stare.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"examples": patch
|
||||
---
|
||||
|
||||
examples: Update Astro template.
|
||||
4
examples/astro/.gitignore
vendored
4
examples/astro/.gitignore
vendored
@@ -1,3 +1,6 @@
|
||||
# astro
|
||||
.astro
|
||||
|
||||
# build output
|
||||
dist/
|
||||
.output/
|
||||
@@ -11,7 +14,6 @@ yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
|
||||
# environment variables
|
||||
.env
|
||||
.env.production
|
||||
|
||||
@@ -3,10 +3,9 @@
|
||||
This directory is a brief example of an [Astro](https://astro.build/) site that can be deployed to Vercel with zero configuration. This demo showcases:
|
||||
|
||||
- `/` - A static page (pre-rendered)
|
||||
- `/ssr` - A page that uses server-side rendering (through [Vercel Edge Functions](https://vercel.com/docs/functions/edge-functions))
|
||||
- `/ssr` - A page that uses server-side rendering (through [Vercel Functions](https://vercel.com/docs/functions))
|
||||
- `/ssr-with-swr-caching` - Similar to the previous page, but also caches the response on the [Vercel Edge Network](https://vercel.com/docs/edge-network/overview) using `cache-control` headers
|
||||
- `/image` - Astro [Asset](https://docs.astro.build/en/guides/assets/) using Vercel [Image Optimization](https://vercel.com/docs/image-optimization)
|
||||
- `/edge.json` - An Astro API Endpoint that returns JSON data using [Vercel Edge Functions](https://vercel.com/docs/functions/edge-functions)
|
||||
- `/image` - Astro [Asset](https://docs.astro.build/en/guides/images/) using Vercel [Image Optimization](https://vercel.com/docs/image-optimization)
|
||||
|
||||
Learn more about [Astro on Vercel](https://vercel.com/docs/frameworks/astro).
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
import { defineConfig } from 'astro/config';
|
||||
// Use Vercel Edge Functions (Recommended)
|
||||
import vercel from '@astrojs/vercel/edge';
|
||||
// Can also use Serverless Functions
|
||||
// import vercel from '@astrojs/vercel/serverless';
|
||||
// Or a completely static build
|
||||
// import vercel from '@astrojs/vercel/static';
|
||||
|
||||
export default defineConfig({
|
||||
output: 'server',
|
||||
experimental: {
|
||||
assets: true
|
||||
},
|
||||
adapter: vercel({
|
||||
imageService: true,
|
||||
}),
|
||||
});
|
||||
9
examples/astro/astro.config.ts
Normal file
9
examples/astro/astro.config.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { defineConfig } from 'astro/config';
|
||||
import vercelServerless from '@astrojs/vercel/serverless';
|
||||
|
||||
export default defineConfig({
|
||||
output: 'server',
|
||||
adapter: vercelServerless({
|
||||
imageService: true,
|
||||
}),
|
||||
});
|
||||
@@ -8,9 +8,9 @@
|
||||
"astro": "astro"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/vercel": "3.8.2",
|
||||
"astro": "^2.10.14",
|
||||
"react": "18.2.0",
|
||||
"web-vitals": "^3.3.1"
|
||||
"@astrojs/vercel": "7.6.0",
|
||||
"astro": "^4.9.2",
|
||||
"react": "18.3.1",
|
||||
"web-vitals": "^4.0.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
export async function get() {
|
||||
return new Response(JSON.stringify({ time: new Date() }), {
|
||||
status: 200,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Cache-Control': 's-maxage=10, stale-while-revalidate',
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user