@@ -3,7 +3,9 @@ REST API framework for go lang
33
44# Framework is under development
55## Status:
6- - Working on POC
6+ Released alpha version
7+ <br >
8+ See examples
79 - Request Interceptors/Middlewares
810 - Routes with URL pattern
911 - Methods [ GET, POST, PUT, DELETE, OPTIONS, HEAD, PATCH]
@@ -20,22 +22,22 @@ api.Use(func(ctx *rest.Context) {
2022})
2123
2224// routes
23- api.GET ("/", func(ctx *rest.Context) {
24- ctx.Send ("Hello World!")
25+ api.Get ("/", func(ctx *rest.Context) {
26+ ctx.Text ("Hello World!")
2527})
2628
27- api.GET ("/foo", func(ctx *rest.Context) {
29+ api.Get ("/foo", func(ctx *rest.Context) {
2830 ctx.Status(401).Throw(errors.New("UNAUTHORIZED"))
2931})
3032
31- api.GET ("/:bar", func(ctx *rest.Context) {
33+ api.Get ("/:bar", func(ctx *rest.Context) {
3234 fmt.Println("authtoken", ctx.Get("authtoken"))
33- ctx.SendJSON (ctx.Params)
35+ ctx.JSON (ctx.Params)
3436})
3537
3638// error handler
3739api.Error("UNAUTHORIZED", func(ctx *rest.Context) {
38- ctx.Send ("You are unauthorized")
40+ ctx.Text ("You are unauthorized")
3941})
4042
4143fmt.Println("Starting server.")
0 commit comments