Skip to content

MaksimZayats/godi-fiber-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

godi-fiber-example

A real example of using GoDI

Snippet

type H = func(*fiber.Ctx) error

// `stringFromDI` will be injected into the handler
func handler(c *fiber.Ctx, stringFromDI string) error {
    return c.SendString("Hello from di: " + stringFromDI)
}

func main() {
    di.AddInstance[string]("I'm string from DI!!!", c)
    ...
    app.Get("/", injection.Inject[H](handler))
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages