In this video we look at how to build an API with an API-first approach. We leverage oapi-codegen to generate a lot of boiler plate for a Go Fiber app.
One approach is using route groups - example here: publicRoute := app.Group("/public") apiRoute := app.Group("/api", middleware.Protected(), middleware.EnrichUser(services.UserService)) Full app - github.com/duanebester/dermsnap-api/blob/main/app/app.go
Great video! How do you apply a middleware to only some handler functions?
One approach is using route groups - example here:
publicRoute := app.Group("/public")
apiRoute := app.Group("/api", middleware.Protected(), middleware.EnrichUser(services.UserService))
Full app - github.com/duanebester/dermsnap-api/blob/main/app/app.go
For some reason, I cannot run oapi-codegen in the terminal after installing it with "go install".
Have you added your GOPATH to your PATH env ?