mingyang_http
v2025.9.12
Published
simplified and efficient httpServer component
Downloads
45
Maintainers
Readme
introduction
- 精简高效的httpServer组件,体积小巧,运行高效,代码简单,支持multipart/form-data格式,支持通配路由,支持路由变量,能完美运行在 (aliyun FC / tencent SCF) 中,使用最小内存选项即可。
- simplified and efficient httpServer component, small size, efficient operation, simple code, support multipart/form-data format, support wildcard routing, support routing variables, works perfectly in (aliyun function compute) and (tencent cloud serverless cloud function), minimum memory can be used.
environment
- 1 General Node(nodejs)
- 2 Aliyun FC (aliyun function compute)
- 3 Tenyun SCF (tencent cloud SCF Node)
run
- 1 NodeJS(on os)
run “sample_bin.js directly(need to set environment variable develoment=true or delete related code in sample_bin.js)
- 2 Aliyun FC (aliyun function compute)
setup:function>setting>functing entry to “sample_bin.requestForAliyun”(its default value generally is index.handler)
- 3 Tenyun SCF (tencent cloud SCF Node)
setup:function>setting>functing entry to “sample_bin.requestForTenyun default value generally is index.main_handler)
test
- 查看original message和匹配的router,router-variable
- View original message and matching router,router-variable http://localhost:9090/root/path?key0=value0&key1=value1
- 返回1234的62进制形式
- Returns 1234 in base 62 http://localhost:9090/base62/1234
- 返回从【2023-01-01到现在】的时间戳的62进制形式
- Returns the base 62 form of the timestamp from [2023-01-01 to present] http://localhost:9090/base62/2023/
- 返回10个time开头的有字母ID(有分段符)
- Returns 10 alphabetic IDs starting with time (with segment characters) http://localhost:9090/timeid/10
- 返回20个time开头的有字母ID(无分段符)
- Returns 20 alphabetic IDs starting with time (no segment characters) http://localhost:9090/timeID/20
- 返回30个time开头的全数字ID(有分段符)
- Returns 30 numeric IDs starting with times (with segment characters) http://localhost:9090/timeno/30
- 返回40个time开头的全数字ID(无分段符)
- Returns 40 numeric IDs starting with times (no segment characters) http://localhost:9090/timeNO/40
- 其它路由
- other router http://localhost:9090/insert/abcd?key=value
- 其它路由
- other router http://localhost:9090/select/abcd?key=value
history
- 2023-08-26
- 去掉了post和put时候 强制要求content-length大于0的要求
- Removed the requirement that content-length be greater than 0 when post and put are mandatory
- 未配置 允许的content-type 的情况下,那么允许所有的
- If the allowed content-type is not configured, all are allowed
- 优化一些http状态码的提示语
- Optimized some http status code prompts
- 增加了示例代码 sample_bin:入口文件; sample_router:路由文件
- Added sample file sample_bin:entry file; sample_router:router file
- 2023-10-13
- 去掉了对mingyang_data包的依赖
- Removed the dependency on the mingyang_data package
- request在任何情况下都有字段routerVariable
- In any case there is a field routerVariable
- 2024-01-17
- 适配了腾讯云SCF
- Adapted to tencent cloud serverless cloud function
- 2024-02-04
- 优化了body中的代码
- Optimized the code in the body
- 优化了示例代码
- Optimized the sample code (sample_bin.js and sample_router.js)
- 2025-07-30
- 精简了body中的代码
- Simplify the code in the body
- 优化了示例代码,适配了aliyunFC3.0的环境(见sample_bin.js)
- Optimized the sample code (sample_bin.js and sample_router.js) and adapted to the aliyunFC3.0 environment
- 在sample_bin.js中增加了(httpServer和webSocket使用相同的端口)的示例代码
- Added example code in sample_bin.js (using the same port for httpServer and webSocket)
- 2025-08-06
- 为了便于排查错误,除了404错误,其它的情况都返回给调用方
- To facilitate error troubleshooting, all cases except 404 errors will be returned to the caller.
- 2025-08-16
- 在客户端传来application/json的时候,需要解析JSON,如果解析失败给出400信号
- Return a 400 status code when JSON parsing fails.
- 2025-09-12
- 引用了最新版本的mingyang_text包,在对KeyValue数据解码的时候,不对Value进行decodeURIComponent解码
- The latest version of the mingyang_text package is referenced, and when decoding KeyValue data, decodeURIComponent decoding is not performed on the Value.
author
- fujun wang([email protected])
- Wangjing Beijing China
- origin of the name : mingyang is my son's name
- last modified : 2025-09-12
