firmeve

package module
v0.0.0-...-7c51b95 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2021 License: MIT Imports: 7 Imported by: 0

README

This is a web framework that firmly believes in dreams.

Firmeve = Firm + Believe

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.

Build Status codecov GitHub license Go Report Card

Quick start

go get -u github.com/firmeve/firmeve@develop

base

Docs

https://docs.firmeve.com/v/develop/

Example

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()
        })
    }
}

Bootstrap command

go run main.go http:serve

Feature list

Directories

Path Synopsis
converter
examples
mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL