-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
37 lines (30 loc) · 1.06 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import (
"log"
"net/http"
"p2p-money-market/database"
"p2p-money-market/handlers"
)
func main() {
// Initialize the database
db, err := database.InitializeDb("database.db")
if err != nil {
log.Fatal("Failed to initialize database:", err)
}
handlers.DB = db
// Initialize templates
handlers.InitTemplates("template")
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static"))))
http.HandleFunc("/", handlers.HandleLandingPage)
http.HandleFunc("/register", handlers.RegisterUserHandler)
http.HandleFunc("/login", handlers.LoginHandler)
http.HandleFunc("/account", handlers.HandleBankAccount)
http.HandleFunc("/wallet", handlers.HandleWallet)
http.HandleFunc("/assets", handlers.HandleAssets)
http.HandleFunc("/chamas", handlers.HandleChamas)
http.HandleFunc("/funds", handlers.HandleFunds)
http.HandleFunc("/transactions", handlers.HandleTransactions)
http.HandleFunc("/loans", handlers.HandleLoans)
log.Println("server started at port: http://localhost:1234")
log.Fatal(http.ListenAndServe(":1234", nil))
}