« Home

rocket [rocket]

Project link: https://github.com/dannypsnl/rocket

import (
    "github.com/dannypsnl/rocket"
)

type User struct {
    Name string `route:"name"`
    Age  uint64 `route:"age"`
}

func hello(u *User) string {
    return "Hello " + u.Name + ", your age is " + strconv.FormatUint(u.Age, 10)
}

// main.go
func main() {
    rocket.Ignite(8080).
        Mount(
            // put `hello` under a path `/user/:name/:age`, where `:name` and `:age` are variant parameters
            rocket.Get("/user/:name/:age", hello),
        ).
        Launch()
}