diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 00000000..e69de29b diff --git a/404.html b/404.html new file mode 100644 index 00000000..207ba683 --- /dev/null +++ b/404.html @@ -0,0 +1,979 @@ + + + +
+ + + + + + + + + + + + + + + + +The --advanced
flag in Blueprint serves as a switch to enable additional features during project creation. It is applied with the create
command and unlocks the following features:
HTMX Support using Templ: +Enables the integration of HTMX support for dynamic web pages using Templ.
+CI/CD Workflow Setup using GitHub Actions: +Automates the setup of a CI/CD workflow using GitHub Actions.
+Websocket Support: +WebSocket endpoint that sends continuous data streams through the WS protocol.
+Tailwind: +Adds Tailwind CSS support to the project.
+To utilize the --advanced
flag, use the following command:
go-blueprint create --name <project_name> --framework <selected_framework> --driver <selected_driver> --advanced
+
+By including the --advanced
flag, users can choose one or all of the advanced features. The flag enhances the simplicity of Blueprint while offering flexibility for users who require additional functionality.
To recreate the project using the same configuration semi-interactively, use the following command:
+go-blueprint create --name my-project --framework chi --driver mysql --advanced
+
+Non-Interactive Setup is also possible:
+go-blueprint create --name my-project --framework chi --driver mysql --advanced --feature htmx --feature githubaction --feature websocket --feature tailwind
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Release process for Go projects, providing extensive customization options through its configuration file, .goreleaser.yml
. By default, it ensures dependency cleanliness, builds binaries for various platforms and architectures, facilitates pre-release creation, and organizes binary packaging into archives with naming schemes.
For comprehensive insights into customization possibilities, refer to the GoReleaser documentation.
+To initiate release builds with GoReleaser, you need to follow these steps:
+git tag v1.0.0
+
+git push origin v1.0.0
+
+Following these steps ensures proper tagging of your project, prompting GoReleaser to execute configured releases. This approach simplifies release management and automates artifact distribution.
+The go-test.yml
file defines a GitHub Actions workflow for continuous integration (CI) of Go projects within a GitHub repository.
The job outlined in this workflow includes the following steps:
+Checkout: + Fetches the project's codebase from the repository.
+Go Setup: + Configures the Go environment with version 1.21.x.
+Build and Test:
+ Builds the project using go build
and runs tests across all packages (./...
) using go test
.
This workflow serves to automate the testing process of a Go project within a GitHub repository, ensuring code quality and reliability with each commit and pull request.
+ + + + + + + + + + + + + +The WEB directory contains the web-related components and assets for the project. It leverages htmx and templ in Go for dynamic web content generation.
+web/
+│
+│
+├── assets/
+│ └── js/
+│ └── htmx.min.js # htmx library for dynamic HTML content
+│
+├── base.templ # Base template for HTML structure
+├── base_templ.go # Generated Go code for base template
+├── efs.go # Embeds static files into the Go binary
+│
+├── hello.go # Handler for the Hello Web functionality
+├── hello.templ # Template for rendering the Hello form and post data
+└── hello_templ.go # Generated Go code for hello template
+
+cd my-project
+
+go install github.com/a-h/templ/cmd/templ@latest
+
+templ generate
+
+make run
+
+Templates are generated using the templ generate
command after project creation. These templates are then compiled into Go code for efficient execution.
You can test HTMX functionality on localhost:port/web
endpoint.
Tailwind is closely coupled with the advanced HTMX flag, and HTMX will be automatically used if you select Tailwind in your project.
+We do not introduce outside dependencies automatically, and you need compile output.css (file is empty by default) with the Tailwind CLI tool.
+The project tree would look like this:
+/ (Root)
+├── cmd/
+│ ├── api/
+│ │ └── main.go
+│ └── web/
+│ ├── assets/
+│ │ ├── css/
+│ │ │ ├── input.css
+│ │ │ └── output.css
+│ │ └── js/
+│ │ └── htmx.min.js
+│ ├── base.templ
+│ ├── base_templ.go
+│ ├── efs.go
+│ ├── hello.go
+│ ├── hello.templ
+│ └── hello_templ.go
+├── internal/
+│ └── server/
+│ ├── routes.go
+│ ├── routes_test.go
+│ └── server.go
+├── go.mod
+├── go.sum
+├── Makefile
+├── README.md
+└── tailwind.config.js
+
+The idea is not to use Node.js and npm to build output.css
. To achieve this, visit the official repository and download the latest release version for your OS and Arch:
curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/download/v3.4.4/tailwindcss-linux-x64
+
+Give execution permission:
+chmod +x tailwindcss-linux-x64
+
+./tailwindcss-linux-x64 -i cmd/web/assets/css/input.css -o cmd/web/assets/css/output.css
+
+By default, CSS examples are not included in the codebase. +Update base.templ and hello.templ, then rerun templ generate to see the changes at the localhost:PORT/web endpoint.
+ + + + + + + + + + + + + +A /websocket
endpoint is added in routes.go
to facilitate websocket connections. Upon accessing this endpoint, the server establishes a websocket connection and begins transmitting timestamp messages at 2-second intervals. WS is utilized across all Go-blueprint supported frameworks. This simple implementation showcases how flexible project is.
func (s *Server) websocketHandler(c *gin.Context) {
+ w := c.Writer
+ r := c.Request
+ socket, err := websocket.Accept(w, r, nil)
+
+ if err != nil {
+ log.Printf("could not open websocket: %v", err)
+ _, _ = w.Write([]byte("could not open websocket"))
+ w.WriteHeader(http.StatusInternalServerError)
+ return
+ }
+
+ defer socket.Close(websocket.StatusGoingAway, "server closing websocket")
+
+ ctx := r.Context()
+ socketCtx := socket.CloseRead(ctx)
+
+ for {
+ payload := fmt.Sprintf("server timestamp: %d", time.Now().UnixNano())
+ err := socket.Write(socketCtx, websocket.MessageText, []byte(payload))
+ if err != nil {
+ break
+ }
+ time.Sleep(time.Second * 2)
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {"use strict";/*!
+ * escape-html
+ * Copyright(c) 2012-2013 TJ Holowaychuk
+ * Copyright(c) 2015 Andreas Lubbe
+ * Copyright(c) 2015 Tiancheng "Timothy" Gu
+ * MIT Licensed
+ */var Va=/["'&<>]/;qn.exports=za;function za(e){var t=""+e,r=Va.exec(t);if(!r)return t;var o,n="",i=0,s=0;for(i=r.index;i