- A powerfull go web framework
- Fast 🚀
- Secure 🔒
- Easy Peasy :)
go get -u github.com/godzillaframework/godzilla
package main
import "github.com/godzillaframework/godzilla"
func main() {
gz := godzilla.New()
gz.Get("/index", func(ctx godzilla.Context) {
ctx.SendString("Hello EveryOne!!!")
})
gz.Start(":9090")
}
package main
import "github.com/godzillaframework/godzilla"
func main() {
gz := godzilla.New()
gz.Get("/users/:user", func(ctx godzilla.Context) {
ctx.SendString(ctx.Param("user"))
})
gz.Start(":8080")
}
package main
import "github.com/godzillaframework/godzilla"
func main() {
gz := godzilla.New()
gz.Static("/imgs", "./images")
/* go to localhost:8080/imgs/image.png */
gz.Start(":8080")
}
package main
import (
"log"
"github.com/godzillaframework/godzilla"
)
func main() {
gz := godzilla.New()
logMiddleware := func(ctx godzilla.Context) {
log.Printf("log message!")
ctx.Next()
}
gz.Use(logMiddleware)
gz.Start(":8080")
package main
import (
"log"
"github.com/godzillaframework/godzilla"
)
func main() {
gz := godzilla.New()
unAuthorizedMiddleware := func(ctx godzilla.Context) {
ctx.Status(godzilla.StatusUnauthorized).SendString("You are unauthorized to access this page!")
}
gz.Get("/hello", func(ctx godzilla.Context) {
ctx.SendString("Hello World!")
})
gz.Get("/protected", unAuthorizedMiddleware, func(ctx godzilla.Context) {
ctx.SendString("You accessed a protected page")
})
gz.Start(":8080")
}