feat: add initial Go+HTMX web project structure
This commit is contained in:
		
							
								
								
									
										26
									
								
								cmd/web/main.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								cmd/web/main.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | ||||
| package main | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"net/http" | ||||
| 	"os" | ||||
| 	 | ||||
| 	"github.com/go-chi/chi/v5" | ||||
| 	"github.com/go-chi/chi/v5/middleware" | ||||
| ) | ||||
|  | ||||
| func main() { | ||||
| 	r := chi.NewRouter() | ||||
| 	r.Use(middleware.Logger) | ||||
| 	 | ||||
| 	// Setup routes | ||||
| 	r.Get("/", handleHome) | ||||
| 	 | ||||
| 	port := ":3000" | ||||
| 	fmt.Printf("Starting server on %s\n", port) | ||||
| 	err := http.ListenAndServe(port, r) | ||||
| 	if err != nil { | ||||
| 		fmt.Println(err) | ||||
| 		os.Exit(1) | ||||
| 	} | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Grail Finder (aider)
					Grail Finder (aider)