File tree Expand file tree Collapse file tree 3 files changed +18
-12
lines changed
Expand file tree Collapse file tree 3 files changed +18
-12
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,9 @@ func (api *APIServer) Start() error {
7878 r := NewRouter(api.env )
7979 r.RegisterRoutes (mux)
8080
81+ // Static routes
82+ api.ServeStatic (mux)
83+
8184 log.Printf (" Visit http://localhost%s " , api.listenAddr )
8285
8386 return http.ListenAndServe (api.listenAddr , mux)
@@ -100,8 +103,6 @@ func logger(h http.Handler) http.Handler {
100103func (api *APIServer) registerGlobalMiddlewares(mux *chi.Mux ) {
101104 mux.Use (logger) // Logger should come before Recoverer
102105 mux.Use (middleware.Recoverer )
103-
104- api.ServeStatic (mux)
105106}
106107{{- else if .Render.IsSeperate -}}
107108package api
@@ -146,6 +147,9 @@ func (api *APIServer) Start() error {
146147 // Routes
147148 r := NewRouter(api.env )
148149 r.RegisterRoutes (mux)
150+
151+ // Static routes
152+ api.ServeStatic (mux)
149153
150154 log.Printf (" Visit http://localhost%s " , api.listenAddr )
151155
@@ -156,7 +160,5 @@ func (api *APIServer) Start() error {
156160func (api *APIServer) registerGlobalMiddlewares(mux *chi.Mux ) {
157161 mux.Use (middleware.Logger ) // Logger should come before Recoverer
158162 mux.Use (middleware.Recoverer )
159-
160- api.ServeStatic (mux)
161163}
162164{{- end -}}
Original file line number Diff line number Diff line change @@ -49,6 +49,9 @@ func (api *APIServer) Start() error {
4949 r := NewRouter(api.env )
5050 r.RegisterRoutes (e.Router ())
5151
52+ // Static routes
53+ api.ServeStatic (e)
54+
5255 log.Printf (" Visit http://localhost%s " , api.listenAddr )
5356
5457 return e.Start (api.listenAddr )
@@ -80,8 +83,6 @@ func (api *APIServer) registerGlobalMiddlewares(e *echo.Echo) {
8083
8184 e.HTTPErrorHandler = HTTPErrorHandler
8285 e.Renderer = &Template{templates: api.LoadTemplates (e), env: api.env }
83-
84- api.ServeStatic (e)
8586}
8687{{- else if .Render.IsSeperate -}}
8788package api
@@ -126,6 +127,9 @@ func (api *APIServer) Start() error {
126127 r := NewRouter(api.env )
127128 r.RegisterRoutes (e.Router ())
128129
130+ // Static routes
131+ api.ServeStatic (e)
132+
129133 log.Printf (" Visit http://localhost%s " , api.listenAddr )
130134
131135 return e.Start (api.listenAddr )
@@ -139,7 +143,5 @@ func (api *APIServer) registerGlobalMiddlewares(e *echo.Echo) {
139143 }))
140144
141145 e.HTTPErrorHandler = HTTPErrorHandler
142-
143- api.ServeStatic (e)
144146}
145147{{- end -}}
Original file line number Diff line number Diff line change @@ -68,6 +68,9 @@ func (api *APIServer) Start() error {
6868 r := NewRouter(api.env )
6969 r.RegisterRoutes (app)
7070
71+ // Static routes
72+ api.ServeStatic (app)
73+
7174 log.Printf (" Visit http://localhost%s " , api.listenAddr )
7275
7376 return app.Listen (api.listenAddr )
@@ -82,8 +85,6 @@ func (api *APIServer) registerGlobalMiddlewares(app *fiber.App) {
8285 return strings.HasPrefix (c.Path (), " /public" )
8386 },
8487 }))
85-
86- api.ServeStatic (app)
8788}
8889{{- else if .Render.IsSeperate -}}
8990package api
@@ -131,6 +132,9 @@ func (api *APIServer) Start() error {
131132 r := NewRouter(api.env )
132133 r.RegisterRoutes (app)
133134
135+ // Static routes
136+ api.ServeStatic (app)
137+
134138 log.Printf (" Visit http://localhost%s " , api.listenAddr )
135139
136140 return app.Listen (api.listenAddr )
@@ -140,7 +144,5 @@ func (api *APIServer) Start() error {
140144func (api *APIServer) registerGlobalMiddlewares(app *fiber.App ) {
141145 app.Use (recover.New ())
142146 app.Use (logger.New ())
143-
144- api.ServeStatic (app)
145147}
146148{{- end -}}
You can’t perform that action at this time.
0 commit comments