mirror of
https://github.com/ssep1ol/overleaf-registration-be.git
synced 2026-07-21 20:40:21 +00:00
29 lines
500 B
Go
29 lines
500 B
Go
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))
|
|
}
|