Last active
October 24, 2020 15:59
-
-
Save johnson86tw/764766edff9c042fb62e19c752398597 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// web framework | |
app := echo.New() | |
// middleware | |
app.Use(middleware.Logger()) | |
app.Use(middleware.Recover()) | |
// service | |
accountRepo := accountRepo.NewRepository(pgConn) | |
as := accountService.NewAccountService(accountRepo) | |
userURLRepo := userURLRepo.NewRepository(pgConn) | |
us := userURLService.NewUserURLService(userURLRepo) | |
redirectRepo := redirectRepo.NewRepository(pgConn) | |
rs := redirectService.NewRedirectService(redirectRepo, userURLRepo) | |
// api | |
api.NewAccountHandler(app, as, j) | |
api.NewRedirectHandler(app, rs) | |
// auth | |
auth := app.Group("/auth") | |
auth.Use(j.AuthRequired) | |
{ | |
api.NewUserURLHandler(auth, us) | |
} | |
app.Logger.Fatal(app.Start(serverAddr)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment