Be firm in your will and believe in your ideals.
Those who have achieved nothing can always tell you that you can't make a big deal. If you have an ideal, you have to defend it.
go get -u github.com/firmeve/firmeve@develop
package main
import (
"fmt"
"github.com/firmeve/firmeve"
"github.com/firmeve/firmeve/http"
"github.com/firmeve/firmeve/kernel/contract"
"github.com/firmeve/firmeve/render"
)
func main() {
firmeve.RunWithSupportFunc(
application,
firmeve.WithConfigPath("./config.yaml"),
firmeve.WithProviders([]contract.Provider{
new(http.Provider),
}),
firmeve.WithCommands([]contract.Command{
new(http.HttpCommand),
}),
)
}
func application(application contract.Application) {
router := application.Resolve(`http.router`).(contract.HttpRouter)
router.GET("/", func(c contract.Context) {
fmt.Printf("%t", c.Firmeve() == firmeve.Application)
c.RenderWith(200, render.JSON, map[string]string{
"ctx_application": fmt.Sprintf("%p", c.Firmeve()),
"global_application": fmt.Sprintf("%p", firmeve.Application),
})
c.Next()
})
v1 := router.Group("/api/v1")
{
v1.GET(`/ping`, func(c contract.Context) {
c.RenderWith(200, render.JSON, map[string]string{
"message": "pong",
})
c.Next()
})
}
}
go run main.go http:serve