first commit

This commit is contained in:
Blake Ridgway
2026-07-03 21:16:24 -05:00
commit 3d4e2d4b1a
14 changed files with 1447 additions and 0 deletions

80
main.go Normal file
View File

@@ -0,0 +1,80 @@
package main
import (
"html/template"
"log"
"net/http"
"os"
)
func main() {
port := os.Getenv("PORT")
if port == "" {
port = "8080"
}
// Serve static assets
fs := http.FileServer(http.Dir("static"))
http.Handle("/static/", http.StripPrefix("/static/", fs))
// Page routes
http.HandleFunc("/", handleIndex)
// HTMX partial routes
http.HandleFunc("/partials/waitlist", handleWaitlist)
log.Printf("Arcline Project server starting on :%s", port)
if err := http.ListenAndServe(":"+port, nil); err != nil {
log.Fatalf("server failed: %v", err)
}
}
func handleIndex(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/" {
http.NotFound(w, r)
return
}
tmpl, err := template.ParseFiles("templates/base.html", "templates/index.html")
if err != nil {
log.Printf("template error: %v", err)
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
return
}
data := map[string]interface{}{
"Title": "Arcline Project",
}
w.Header().Set("Content-Type", "text/html; charset=utf-8")
if err := tmpl.ExecuteTemplate(w, "base", data); err != nil {
log.Printf("render error: %v", err)
}
}
func handleWaitlist(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodPost {
http.Error(w, "Method Not Allowed", http.StatusMethodNotAllowed)
return
}
email := r.FormValue("email")
// Parse edition preferences (checkboxes with same name)
r.ParseForm()
editions := r.Form["edition"]
log.Printf("Waitlist signup: %s | editions: %v", email, editions)
tmpl, err := template.ParseFiles("templates/partials/waitlist_confirmation.html")
if err != nil {
log.Printf("template error: %v", err)
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
return
}
w.Header().Set("Content-Type", "text/html; charset=utf-8")
if err := tmpl.Execute(w, map[string]string{"Email": email}); err != nil {
log.Printf("render error: %v", err)
}
}