-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP Working on incorporating Templ templates
Signed-off-by: Paul Balogh <[email protected]>
- Loading branch information
Showing
9 changed files
with
58 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,7 @@ | |
# Ignore other project items | ||
artifacts/ | ||
bin/ | ||
tmp/ | ||
gorm.db | ||
*_templ.go | ||
*_templ.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Getting Started with Go, Templ, HTMX, and Air...Oh my! | ||
|
||
## Installing Air | ||
- https://github.com/cosmtrek/air | ||
- As a Go module: `go install github.com/cosmtrek/air@latest` (v1.51.0 at this time) | ||
- Run `air init` to create a basic `.air.toml` configuration file | ||
- I'm adding to Makefile as `make develop` target | ||
- Updated the TOML config for `build.cmd` to trigger a database migration on each restart | ||
- Updated the TOML config for `misc.clean_on_exit=true` | ||
- From terminal, run a request as `http POST :9092/api/places name=NISC description="NISC Lake St. Louis Office" latitude:=38.7839 longitude:=90.7878` | ||
- Run `http GET :9092/api/places/1` to retrieve listing | ||
- Change a JSON attribute name for `model/place.go`, then run GET again to show changed attribute | ||
|
||
|
||
## Starting with Templ | ||
- https://github.com/a-h/templ, https://templ.guide/ | ||
- Install Templ CLI as a Go module `go install github.com/a-h/templ/cmd/templ@latest` | ||
- Add use of the CLI to `make develop` to have a watcher on templates to auto-generate Go code from templates | ||
- Update Air configuration to let Templ watch for template changes, then Air will watch for Go changes | ||
- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package views | ||
|
||
templ Index() { | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>StL Go!</title> | ||
</head> | ||
<body> | ||
Hello STLGo From Templ! | ||
</body> | ||
</html> | ||
} |