First commit

This commit is contained in:
corrado.mulas
2024-11-19 22:32:50 +01:00
parent 21d8aea921
commit a2e4ad87db
7 changed files with 268 additions and 0 deletions

28
main.go Normal file
View File

@@ -0,0 +1,28 @@
package main
import (
"log"
"net/http"
"os"
"github.com/joho/godotenv"
)
func main() {
// Load environment variables
err := godotenv.Load()
if err != nil {
log.Println("No .env file found, using environment variables")
}
// Register the HTTP handler
http.HandleFunc("/register", RegisterHandler)
// Start the HTTP server
port := os.Getenv("PORT")
if port == "" {
port = "3000"
}
log.Printf("Server running on port %s\n", port)
log.Fatal(http.ListenAndServe(":"+port, nil))
}