https://github.com/blakeliafk/httpcmd
https://github.com/blakeliafk/httpcmd
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/blakeliafk/httpcmd
- Owner: BlakeLiAFK
- Created: 2022-03-18T04:10:40.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-03-25T03:20:51.000Z (almost 4 years ago)
- Last Synced: 2025-02-07T08:23:30.871Z (11 months ago)
- Language: Go
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## HTTP CMD
```go
import (
"github.com/DGHeroin/httpcmd"
"log"
)
func main() {
r := httpcmd.NewEngine()
r.GET("/status", func(c httpcmd.Context) {
c.Response(200, httpcmd.F{
"code": 0,
"method":"get",
})
})
r.POST("/p", func(c httpcmd.Context, fields httpcmd.F) {
log.Println("bind:", fields)
c.Response(200, httpcmd.F{
"code": 0,
"method":"post",
})
})
r.Run()
}
```
```bash
curl -X POST 127.0.0.1:8080/p --data '{"name":"http cmd", "address":"github.com/DGHeroin/httpcmd"}' -H "Content-Type:application/json"
```