feat: add bun-fullstack agent and update skills
This commit is contained in:
59
.agent/skills/tech-stack/elysiajs/integrations/astro.md
Normal file
59
.agent/skills/tech-stack/elysiajs/integrations/astro.md
Normal file
@@ -0,0 +1,59 @@
|
||||
# Astro Integration - SKILLS.md
|
||||
|
||||
## What It Is
|
||||
Run Elysia on Astro via Astro Endpoint.
|
||||
|
||||
## Setup
|
||||
1. Set output to server:
|
||||
```javascript
|
||||
// astro.config.mjs
|
||||
export default defineConfig({
|
||||
output: 'server'
|
||||
})
|
||||
```
|
||||
|
||||
2. Create `pages/[...slugs].ts`
|
||||
3. Define Elysia server + export handlers:
|
||||
```typescript
|
||||
// pages/[...slugs].ts
|
||||
import { Elysia, t } from 'elysia'
|
||||
|
||||
const app = new Elysia()
|
||||
.get('/api', () => 'hi')
|
||||
.post('/api', ({ body }) => body, {
|
||||
body: t.Object({ name: t.String() })
|
||||
})
|
||||
|
||||
const handle = ({ request }: { request: Request }) => app.handle(request)
|
||||
|
||||
export const GET = handle
|
||||
export const POST = handle
|
||||
```
|
||||
|
||||
WinterCG compliance - works normally.
|
||||
|
||||
Recommended: Run Astro on Bun (Elysia designed for Bun).
|
||||
|
||||
## Prefix for Non-Root
|
||||
If placed in `pages/api/[...slugs].ts`, set prefix:
|
||||
```typescript
|
||||
// pages/api/[...slugs].ts
|
||||
const app = new Elysia({ prefix: '/api' })
|
||||
.get('/', () => 'hi')
|
||||
|
||||
const handle = ({ request }: { request: Request }) => app.handle(request)
|
||||
|
||||
export const GET = handle
|
||||
export const POST = handle
|
||||
```
|
||||
|
||||
Ensures routing works in any location.
|
||||
|
||||
## Benefits
|
||||
Co-location of frontend + backend. End-to-end type safety with Eden.
|
||||
|
||||
## pnpm
|
||||
Manual install:
|
||||
```bash
|
||||
pnpm add @sinclair/typebox openapi-types
|
||||
```
|
||||
Reference in New Issue
Block a user