https://github.com/chenduoduo007/flygo
flygo is an open-source, easy to use web framework for the Go .
https://github.com/chenduoduo007/flygo
api go golang web
Last synced: 5 months ago
JSON representation
flygo is an open-source, easy to use web framework for the Go .
- Host: GitHub
- URL: https://github.com/chenduoduo007/flygo
- Owner: chenduoduo007
- License: apache-2.0
- Created: 2020-10-17T08:55:13.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-09T08:31:07.000Z (over 5 years ago)
- Last Synced: 2024-06-20T22:38:43.934Z (almost 2 years ago)
- Topics: api, go, golang, web
- Language: Go
- Homepage:
- Size: 26.4 KB
- Stars: 6
- Watchers: 1
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# flygo
flygo is an open-source, easy to use web framework for the Go .
a simple web framework
go get -u github.com/chenduoduo007/flygo
go mod
require (
github.com/chenduoduo007/flygo v0.0.2
)
main.go
package main
import "github.com/chenduoduo007/flygo"
func main() {
r := flygo.Default()
r.GET("/", func(c *flygo.Context) {
c.String(http.StatusOK, "Hello Flygo")
})
r.GET("/api", func(c *flygo.Context) {
data := map[string]interface{}{
"code": 200,
"msg": "success",
"data": map[string]interface{}{},
}
c.JSON(http.StatusOK, data)
})
endPoint := ":8080"
log.Printf("[info] start http server listening %s", endPoint)
err := r.Run(endPoint)
if err != nil {
log.Printf("[error] %s", err)
}
}