-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
package main
import(
"github.com/coocood/jas"
"net/http"
"fmt"
"bytes"
)
type Add struct {}
func (*Add) Get (ctx *jas.Context) {
ctx.Data = "hello world"
}
func (*Add) Post (ctx *jas.Context) {
buf:=new(bytes.Buffer)
buf.ReadFrom(ctx.Request.Body)
fmt.Println(buf.String())
ctx.Data = " world hello"
}
func main () {
router := jas.NewRouter(new(Add))
http.Handle("/", router)
http.ListenAndServe(":8080", nil)
}
curl -X POST http://localhost:8080/add -H "Content-Type: application/json" -d @data.json
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels