-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor! #20
refactor! #20
Conversation
@@ -22,7 +23,11 @@ func RouteHelloGroup(app *fiber.App, config *config.Config) { | |||
unprotected := app.Group("/hello") | |||
|
|||
//Endpoints | |||
protected.Get("/world", hello.RetHelloWorld) | |||
unprotected.Get("/world", hello.RetHelloWorld) | |||
protected.Get("/world", func(c *fiber.Ctx) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you create a struct with the db as a field, you can simplify this.
struct example
register route example
) | ||
|
||
func RetHelloWorld(ctx *fiber.Ctx) error { | ||
func RetHelloWorld(ctx *fiber.Ctx, db *pgx.Conn) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by doing the struct field approach, you will resolve this error. also, is this really a "transaction"? i would consider this a handler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* pass databse down to backend routes * fix db error return * Co-authored-by: Garrett Ladley <[email protected]> * Co-authored-by: Garrett Ladley <[email protected]> * lint fxes
* pass databse down to backend routes * fix db error return * Co-authored-by: Garrett Ladley <[email protected]> * Co-authored-by: Garrett Ladley <[email protected]> * lint fxes
Description
[Link to Ticket](insert the link to your ticket inside the parenthesis here)
Please include a summary of the changes and the related issue. Please also
include relevant motivation, context, and images!
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. If they are unit
tests, provide the file name the tests are in. If they are not unit tests,
describe how you tested the change.
Checklist