Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Add a guide for Next.js route handlers, Hono and other fetch-based runtimes

已關閉
#72 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
78/100
Issue 類型
文件
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
bun, deno, next.js, typescript
領域
documentation

研究方向

Read packages/server/src/adapters/vercel.ts and the Next.js Integration in website/src/content/docs/examples/vercel-full.mdx, then review website/src/content/docs/server/ and the sidebar in website/astro.config.mjs for conventions. Add a Server guide covering the listed Fetch API runtimes and update the existing Next.js snippet. Test the examples with the specified requests and run pnpm --filter @chatcops/website build; done means the examples and sidebar are updated and the build succeeds.

由索引模型根據 Issue 內容生成。

描述

documentation hacktoberfest help wanted server

chatcopsVercelHandler is a plain (request: Request) => Promise<Response> function, so it works in any runtime built on the Fetch API: Next.js App Router route handlers, Hono, Bun and Deno. We don't have a guide for these. The one Next.js snippet we have (in the Vercel full example) only exports POST. The handler answers CORS preflight on OPTIONS, so a widget on another origin needs OPTIONS routed to it too. This is the same kind of problem as #40, which covered Express and is fixed now.

Where to look

  • packages/server/src/adapters/vercel.ts
  • website/src/content/docs/examples/vercel-full.mdx ("Next.js Integration")
  • website/src/content/docs/server/ (existing adapter pages, to match the style)
  • website/astro.config.mjs (sidebar)

Acceptance criteria

  • New page, e.g. website/src/content/docs/server/fetch-runtimes.mdx, in the Server section of the sidebar
  • Examples for:
    • Next.js App Router: app/api/chat/route.ts exporting both POST and OPTIONS
    • Hono: app.all(...) or app.on(['POST', 'OPTIONS'], ...), passing c.req.raw
    • Bun (Bun.serve) and Deno (Deno.serve)
  • Each example creates the handler once at module level, not per request
  • A note that rate limiting uses the first x-forwarded-for IP. When that header is missing (common when running Bun or Deno directly), all requests share one "unknown" key, so put a proxy in front or set the header.
  • The Next.js snippet in vercel-full.mdx also exports OPTIONS
  • You've tested each example locally with a placeholder API key such as 'test': an OPTIONS request returns 204 with the CORS headers, and a POST with a broken JSON body returns 400
  • pnpm --filter @chatcops/website build succeeds
  • Docs only, no changeset needed

Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off dev, and open your PR against dev with Closes #<this issue number>. Setup notes (pnpm, build before test) are in CONTRIBUTING.md.

主要語言
TypeScript
星號
13
分支
7
平均合併
3 小時 41 分鐘
30 天內合併 PR
155

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

codercops/chatcops 的其他 Issue

查看 codercops/chatcops 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。