一个包含多个简单 Go HTTP 服务的工具集合。
├── build/ # 构建脚本 │ ├── file.sh # 编译 file 服务 │ ├── json.sh # 编译 json 服务 │ └── txt.sh # 编译 txt 服务 ├── dist/ # 编译输出目录 │ ├── file # file 服务 (Linux) │ ├── file.exe # file 服务 (Windows) │ ├── json # json 服务 (Linux) │ └── txt # txt 服务 (Linux) ├── src/ # 源代码 │ ├── file/ # 文件上传服务 │ ├── json/ # JSON API 服务 │ └── txt/ # 文本服务 └── www/ # 静态文件目录
提供 Web 界面的文件上传功能,并托管静态文件。
-p 参数指定)/upload - 文件上传页面 (GET) 和上传接口 (POST)/ - 强制下载 - 强制下载 www 目录下的文件# 运行(默认端口 80)
./dist/file
# 指定端口
./dist/file -p 8080
返回 JSON 格式响应的简单 API 服务。
-p 参数指定){"msg":"123"}# 运行(默认端口 80)
./dist/json
# 指定端口
./dist/json -p 8080
返回纯文本响应的简单服务。
-p 参数指定)123# 运行(默认端口 80)
./dist/txt
# 指定端口
./dist/txt -p 8080
# 构建所有服务
cd build && bash *.sh
# 或单独构建
bash build/file.sh
bash build/json.sh
bash build/txt.sh
net/httpMIT