Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/maksimzayats/godi-fiber-example


https://github.com/maksimzayats/godi-fiber-example

Last synced: 14 days ago
JSON representation

Awesome Lists containing this project

README

        

# godi-fiber-example

## A real example of using [GoDI](https://github.com/MaximZayats/godi)

## Snippet
```go
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))
}
```