Skip to content

Disac/beauty

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

beauty

a beauty render for macaron

Intro

the gospel of obsessive-compulsive disorder patientst

consistent return results for macaron

Use

go get -u github.com/mougeli/beauty

m.Use(beauty.Render())

type Foo struct{
    Foo string `json:"foo"`
    Bar string `json:"bar"`
}

m.Get("/api/err", func(ctx *macaron.Context, r beauty.Render){
    err := errors.new("simple err")
    r.Error(err)
});

m.Get("/api/result", func(ctx *macaron.Context, r beauty.Render){
    result := &Foo{
        Foo : "bar",
        Bar : "foo",
    }
    r.OK(result)
});
{
    "code" : -1,
    "msg" : "simple err"
}

{
    "code" : 0,
    "msg" : "ok",
    "data" : {
        "foo" : "bar",
        "bar" : "foo"
    }
}

About

a beauty render for macaron

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%