Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maksimzayats/godi-fiber-example
https://github.com/maksimzayats/godi-fiber-example
Last synced: 14 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/maksimzayats/godi-fiber-example
- Owner: MaksimZayats
- Created: 2022-05-01T19:17:58.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-05-04T16:11:25.000Z (over 2 years ago)
- Last Synced: 2024-11-07T13:16:50.809Z (2 months ago)
- Language: Go
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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))
}
```