Renamed container package services.
This commit is contained in:
parent
195d572036
commit
1fe906a6f9
9 changed files with 42 additions and 43 deletions
|
|
@ -6,6 +6,7 @@ import (
|
|||
"goweb/config"
|
||||
"goweb/controller"
|
||||
"goweb/middleware"
|
||||
"goweb/services"
|
||||
|
||||
"github.com/go-playground/validator/v10"
|
||||
|
||||
|
|
@ -14,8 +15,6 @@ import (
|
|||
|
||||
"github.com/labstack/echo/v4"
|
||||
echomw "github.com/labstack/echo/v4/middleware"
|
||||
|
||||
"goweb/container"
|
||||
)
|
||||
|
||||
type Validator struct {
|
||||
|
|
@ -31,7 +30,7 @@ func (v *Validator) Validate(i interface{}) error {
|
|||
|
||||
// TODO: This is doing more than building the router
|
||||
|
||||
func BuildRouter(c *container.Container) {
|
||||
func BuildRouter(c *services.Container) {
|
||||
// Static files with proper cache control
|
||||
// funcmap.File() should be used in templates to append a cache key to the URL in order to break cache
|
||||
// after each server restart
|
||||
|
|
@ -75,7 +74,7 @@ func BuildRouter(c *container.Container) {
|
|||
userRoutes(c, g, ctr)
|
||||
}
|
||||
|
||||
func navRoutes(c *container.Container, g *echo.Group, ctr controller.Controller) {
|
||||
func navRoutes(c *services.Container, g *echo.Group, ctr controller.Controller) {
|
||||
home := Home{Controller: ctr}
|
||||
g.GET("/", home.Get).Name = "home"
|
||||
|
||||
|
|
@ -87,7 +86,7 @@ func navRoutes(c *container.Container, g *echo.Group, ctr controller.Controller)
|
|||
g.POST("/contact", contact.Post).Name = "contact.post"
|
||||
}
|
||||
|
||||
func userRoutes(c *container.Container, g *echo.Group, ctr controller.Controller) {
|
||||
func userRoutes(c *services.Container, g *echo.Group, ctr controller.Controller) {
|
||||
logout := Logout{Controller: ctr}
|
||||
g.GET("/logout", logout.Get, middleware.RequireAuthentication()).Name = "logout"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"goweb/config"
|
||||
"goweb/container"
|
||||
"goweb/services"
|
||||
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
|
@ -18,7 +18,7 @@ import (
|
|||
|
||||
var (
|
||||
srv *httptest.Server
|
||||
c *container.Container
|
||||
c *services.Container
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
|
|
@ -26,7 +26,7 @@ func TestMain(m *testing.M) {
|
|||
config.SwitchEnvironment(config.EnvTest)
|
||||
|
||||
// Start a test HTTP server
|
||||
c = container.NewContainer()
|
||||
c = services.NewContainer()
|
||||
BuildRouter(c)
|
||||
srv = httptest.NewServer(c.Web)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue