emarifer / go-echo-templ-htmx

Go/Echo+Templ+Htmx: Full stack application using Golang's Echo framework & Templ templating language with user session management + CRUD to a SQLite database (To Do List) and HTMX in the frontend
MIT License
234 stars 24 forks source link

fromProtected, isError #3

Closed malaschitz closed 6 months ago

malaschitz commented 6 months ago

These two variables are static. A large number of simultaneous requests can cause problems. Wouldn't it be better if these variables were stored in echo.Context ? Am I wrong ?

emarifer commented 6 months ago

These two variables are static. A large number of simultaneous requests can cause problems. Wouldn't it be better if these variables were stored in echo.Context ? Am I wrong ?

You're right. I only did it this way for simplicity and speed, but, as you say, it can cause problems. I have removed those global flags and stored them in echo.Context and created a middleware to handle the fromProtected flag based on the authentication status on the Home, Login and Register pages.

You can see it in this commit.

Thank you for your advice.👌

malaschitz commented 6 months ago

Thanks. Great project !