Merge branch '14-cleanup' into dev
This commit is contained in:
		
						commit
						f239b17255
					
				@ -78,7 +78,11 @@ func main() {
 | 
			
		||||
 | 
			
		||||
	logger.Info("Starting server", slog.Any("addr", *addr))
 | 
			
		||||
 | 
			
		||||
	err = srv.ListenAndServeTLS("./tls/cert.pem", "./tls/key.pem")
 | 
			
		||||
	if app.debug {
 | 
			
		||||
		err = srv.ListenAndServeTLS("./tls/cert.pem", "./tls/key.pem")
 | 
			
		||||
	} else {
 | 
			
		||||
		err = srv.ListenAndServe()
 | 
			
		||||
	}
 | 
			
		||||
	logger.Error(err.Error())
 | 
			
		||||
	os.Exit(1)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -3,13 +3,13 @@ package main
 | 
			
		||||
import (
 | 
			
		||||
	"net/http"
 | 
			
		||||
 | 
			
		||||
	"git.32bit.cafe/32bitcafe/guestbook/ui"
 | 
			
		||||
	"github.com/justinas/alice"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func (app *application) routes() http.Handler {
 | 
			
		||||
	mux := http.NewServeMux()
 | 
			
		||||
	fileServer := http.FileServer(http.Dir("./ui/static"))
 | 
			
		||||
	mux.Handle("GET /static/", http.StripPrefix("/static", fileServer))
 | 
			
		||||
	mux.Handle("GET /static/", http.FileServerFS(ui.Files))
 | 
			
		||||
 | 
			
		||||
	dynamic := alice.New(app.sessionManager.LoadAndSave, noSurf, app.authenticate)
 | 
			
		||||
	standard := alice.New(app.recoverPanic, app.logRequest, commonHeaders)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user