搜索

PythonReactSEOPDF
OpenClaw

ngamux

Build and modify web services using ngamux, a simple HTTP router for Go. Define routes, apply middleware, handle requests, and send responses efficiently.

hadihammurabi0 来源安装数☆ 0 仓库 Stars

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

SkillHub CLI

skillhub install hadihammurabi/ngamux

打开来源仓库,查看说明和兼容环境后,按来源提供的命令或步骤安装。

将来源链接提供给你的 Agent,让它先读取说明、核对依赖,并向你说明将执行的安装步骤。

查看来源 ↗使用指南

技能说明

When to use this skill

Use this skill when the user needs to:

  • Define HTTP endpoints: Create new routes for various HTTP methods (e.g., mux.Get("/users/:id", getUserHandler)) including dynamic path segments (/users/{id}) and wildcards (/files/*filePath).
  • Implement request preprocessing/postprocessing: Add global middlewares (e.g., for authentication, logging, CORS) or group-specific middlewares to handle requests before they reach the main handler or after they are processed. For example, mux.Use(authMiddleware) or apiGroup.Use(loggingMiddleware).
  • Extract incoming data from requests:
    • URL Parameters: Retrieve values from dynamic path segments (e.g., req.Params("id")).
    • Query Parameters: Access query string values (e.g., req.Query("name", "Guest")).
    • Form Data: Parse application/x-www-form-urlencoded or multipart/form-data (e.g., req.FormValue("username"), req.FormFile("image")).
    • JSON Payloads: Decode application/json request bodies into Go structs (e.g., req.JSON(&user)).
  • Construct and send various response types:
    • JSON Responses: Send structured data as JSON (e.g., ngamux.Res(rw).Status(http.StatusOK).Json(data)).
    • Text Responses: Send plain text (e.g., ngamux.Res(rw).Status(http.StatusOK).Text("Hello, World!")).
    • HTML Responses: Render HTML templates (e.g., ngamux.Res(rw).Status(http.StatusOK).HTML("template.html", data)).
    • Custom Status Codes: Set specific HTTP status codes for responses.
  • Configure router behavior: Adjust global settings like automatically removing trailing slashes (ngamux.WithTrailingSlash()), setting the logging verbosity (ngamux.WithLogLevel(slog.LevelDebug)), or providing custom json.Marshal/json.Unmarshal functions for specific serialization needs.
  • Organize routes with grouping: Create nested route groups to apply common path prefixes and middlewares to a set of routes (e.g., /api/v1).
  • **D...

来源信息

Source
github
Repository
openclaw/skills
Path
skills/hadihammurabi/ngamux
Version
—
Commit
7df700af3a0d806637c7c9e539d62949b6a5d8ad
分类来源
rules
状态
active
可见性
public

这些信息来自收录时的来源分析,可能滞后;使用前请核对最新来源文件。

来源内容

SKILL.md
## When to use this skill
Use this skill when the user needs to:
- **Define HTTP endpoints**: Create new routes for various HTTP methods (e.g., `mux.Get("/users/:id", getUserHandler)`) including dynamic path segments (`/users/{id}`) and wildcards (`/files/*filePath`).
- **Implement request preprocessing/postprocessing**: Add global middlewares (e.g., for authentication, logging, CORS) or group-specific middlewares to handle requests before they reach the main handler or after they are processed. For example, `mux.Use(authMiddleware)` or `apiGroup.Use(loggingMiddleware)`.
- **Extract incoming data from requests**:
    - **URL Parameters**: Retrieve values from dynamic path segments (e.g., `req.Params("id")`).
    - **Query Parameters**: Access query string values (e.g., `req.Query("name", "Guest")`).
    - **Form Data**: Parse `application/x-www-form-urlencoded` or `multipart/form-data` (e.g., `req.FormValue("username")`, `req.FormFile("image")`).
    - **JSON Payloads**: Decode `application/json` request bodies into Go structs (e.g., `req.JSON(&user)`).
- **Construct and send various response types**:
    - **JSON Responses**: Send structured data as JSON (e.g., `ngamux.Res(rw).Status(http.StatusOK).Json(data)`).
    - **Text Responses**: Send plain text (e.g., `ngamux.Res(rw).Status(http.StatusOK).Text("Hello, World!")`).
    - **HTML Responses**: Render HTML templates (e.g., `ngamux.Res(rw).Status(http.StatusOK).HTML("template.html", data)`).
    - **Custom Status Codes**: Set specific HTTP status codes for responses.
- **Configure router behavior**: Adjust global settings like automatically removing trailing slashes (`ngamux.WithTrailingSlash()`), setting the logging verbosity (`ngamux.WithLogLevel(slog.LevelDebug)`), or providing custom `json.Marshal`/`json.Unmarshal` functions for specific serialization needs.
- **Organize routes with grouping**: Create nested route groups to apply common path prefixes and middlewares to a set of routes (e.g., `/api/v1`).
- **D...

相关技能

OpenClaw

geo-optimization

capt-marbles

Generative Engine Optimization (GEO) for AI search visibility. Optimize content to appear in ChatGPT, Perplexity, Claude, and Google AI Overviews. Use when optimizing websites, pages, or content for LLM discove...

OpenClaw

139mail

chang-tong

139邮箱邮件收发 Skill - 支持 IMAP/SMTP 协议,兼容139/QQ/163/Gmail等主流邮箱 功能: 1. 发送邮件(SMTP) 2. 接收邮件(IMAP) 3. 查看收件箱列表 4. 查看未读邮件 当用户提到 "发邮件"、"收邮件"、"查看邮件"、"邮箱"...