Skip to content

Commit 00803f7

Browse files
author
CodeBuddy Attribution Bot
committed
fix(attribution): Skill 文档未清晰说明 HTTP 云函数的代码编写规范 (issue_mns1xuxr_arrdn2)
1 parent 77df745 commit 00803f7

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

  • config/source/skills/cloud-functions

config/source/skills/cloud-functions/SKILL.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ Use this skill when developing, deploying, and operating CloudBase cloud functio
7373
- If the request is for SDK calls, timers, or event-driven workflows, write an **Event Function** with `exports.main = async (event, context) => {}`.
7474
- If the request is for REST APIs, browser-facing endpoints, SSE, or WebSocket, write an **HTTP Function** with `req` / `res` on port `9000`.
7575
- For Node.js HTTP Functions, `req` / `res` does not require Express. When the user asks for native Node.js or does not request a framework, use the built-in `http` module and handle JSON parsing, routes, and status codes yourself.
76+
- For Node.js HTTP Functions, write a complete server entry file: create the server in `index.js`, route on both method and pathname, return JSON with `Content-Type: application/json`, handle malformed JSON with `400`, use `404` for unknown paths and `405` for unsupported methods on known paths, and keep `server.listen(9000)` in the entry file.
7677
- If the user mentions HTTP access for an existing Event Function, keep the Event Function code shape and add gateway access separately.
7778

7879
## Quick decision table

0 commit comments

Comments
 (0)