An open API service indexing awesome lists of open source software.

https://github.com/ganodermaking/easyrest

go easy rest
https://github.com/ganodermaking/easyrest

framework go restful web

Last synced: 3 months ago
JSON representation

go easy rest

Awesome Lists containing this project

README

          

# easyrest
a easy restful framework

# install
```shell
go get -u github.com/ganodermaking/easyrest
```

# use
```go
func main() {
r := easyrest.New()
v1 := r.Group("/api/v1")
{
v1.GET("/users/:id([0-9]+)/:name([a-z]+)", func(c *easyrest.Context) {
c.JSON(http.StatusOK, easyrest.H{
"id": c.Query("id"),
"name": c.Query("name"),
})
})

v1.POST("/users/login", func(c *easyrest.Context) {
c.JSON(http.StatusOK, easyrest.H{
"username": c.PostForm("username"),
"password": c.PostForm("password"),
})
})
}

r.Run(":5000")
}
```