Categorygithub.com/josephschec/go-htmx
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 run make 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 change cmd = "go build -o ./tmp/main.exe ." to cmd = "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 run go 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

Resources

up to https://go.dev/tour/methods/16

# Packages

No description provided by the author
No description provided by the author
No description provided by the author