-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
27 lines (22 loc) · 695 Bytes
/
main.go
File metadata and controls
27 lines (22 loc) · 695 Bytes
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
package main
import (
"log"
"net/http"
"github.com/gorilla/mux"
"mangofinance.com/bank-backend/database"
"mangofinance.com/bank-backend/handlers"
)
// Input: None
// is the entrypoint for the application. It
// sets up a mux router and maps to various
// views, then runs the server on port 4000
func main() {
DB := database.ConnectDB()
h := handlers.New(DB)
router := mux.NewRouter()
router.HandleFunc("/createuser", h.CreateUserAccount).Methods(http.MethodPost)
router.HandleFunc("/login", h.LogInUser).Methods(http.MethodPost)
router.HandleFunc("/viewaccount", h.ViewUserAccount).Methods(http.MethodGet)
log.Println("API is running!")
http.ListenAndServe(":4000", router)
}