diff options
author | Santo Cariotti <santo@dcariotti.me> | 2025-04-02 19:31:12 +0200 |
---|---|---|
committer | Santo Cariotti <santo@dcariotti.me> | 2025-04-02 19:37:12 +0200 |
commit | a9b84f3f3b1d92335188d43048587e32e0921079 (patch) | |
tree | a4313f7660a99745d7d5da4d92dc9509d0dbe35e /cmd/api/main.go | |
parent | 2e92ccd66eb5c31b8fbbcd205d7b4a882450e9d0 (diff) |
Init login and frontend
Diffstat (limited to 'cmd/api/main.go')
-rw-r--r-- | cmd/api/main.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cmd/api/main.go b/cmd/api/main.go new file mode 100644 index 0000000..2120d41 --- /dev/null +++ b/cmd/api/main.go @@ -0,0 +1,22 @@ +package main + +import ( + "os" + + "github.com/boozec/rahanna/api/database" + "github.com/boozec/rahanna/api/handlers" + "github.com/gorilla/mux" + "net/http" +) + +func main() { + database.InitDb(os.Getenv("DATABASE_URL")) + + r := mux.NewRouter() + r.HandleFunc("/register", handlers.RegisterUser).Methods(http.MethodPost) + r.HandleFunc("/login", handlers.LoginUser).Methods(http.MethodPost) + + if err := http.ListenAndServe(":8080", r); err != nil { + panic(err) + } +} |