module
0.0.0-20240519153017-53e2af947f67
Repository: https://github.com/josephschec/go-htmx.git
Documentation: pkg.go.dev
# README
To run:
- For windows install gnu make with
choco install make
then just runmake
at the root directory
Things I learned
- Templating with templ including passing props and dynamic rendering
- Basic file structure for go projects (createing cmd, model, view, handler/controllers folders for organizing)
- How to use Makefile's and run them in windows
- Create and use middleware's in go
- Reading from dontenv with error handling
- when using air with
main.go
in subdirectory you need to changecmd = "go build -o ./tmp/main.exe ."
tocmd = "go build -o ./tmp/main.exe cmd/main.go"
in the.air.toml
The packages I used were:
- Godotenv for reading env file
go get github.com/joho/godotenv
- Echo for route handling
go get github.com/labstack/echo/v4
- First I had to install Templ (for tamplating htmx files)
go install github.com/a-h/templ/cmd/templ@latest
more info on temple here then rungo get github.com/a-h/templ
to use in my project - Air for hot reloading
- Htmx/Tailwind scripts in base layout
- Setup up hot reloading for tailwind and templ
- first run
make tailwind
- then run
air
- first run
Resources
- I chose to follow this walkthough to get a core understanding of how to setup a golang project using temple (formatter) and htmx
- https://htmx.org/docs/
- https://go.dev/tour