mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-10 12:57:47 +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
|
# build output
|
||||||
dist/
|
dist/
|
||||||
.output/
|
.output/
|
||||||
@@ -11,7 +14,6 @@ yarn-debug.log*
|
|||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
pnpm-debug.log*
|
pnpm-debug.log*
|
||||||
|
|
||||||
|
|
||||||
# environment variables
|
# environment variables
|
||||||
.env
|
.env
|
||||||
.env.production
|
.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:
|
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)
|
- `/` - 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
|
- `/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)
|
- `/image` - Astro [Asset](https://docs.astro.build/en/guides/images/) 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)
|
|
||||||
|
|
||||||
Learn more about [Astro on Vercel](https://vercel.com/docs/frameworks/astro).
|
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"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/vercel": "3.8.2",
|
"@astrojs/vercel": "7.6.0",
|
||||||
"astro": "^2.10.14",
|
"astro": "^4.9.2",
|
||||||
"react": "18.2.0",
|
"react": "18.3.1",
|
||||||
"web-vitals": "^3.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