-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
40 lines (31 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
38
39
40
package main
import (
"log"
"net/http"
"github.com/aman7625/iitk-coin/middleware"
"github.com/aman7625/iitk-coin/userInfo"
"github.com/gorilla/mux"
_ "github.com/mattn/go-sqlite3"
)
func main() {
r := mux.NewRouter()
r.HandleFunc("/login", userInfo.Login).Methods("POST")
r.HandleFunc("/signup", userInfo.Singup).Methods("POST")
r.HandleFunc("/secretpage", middleware.Welcome).Methods("GET")
r.HandleFunc("/reward", userInfo.AwardCoins).Methods("POST")
r.HandleFunc("/transfer", userInfo.TransferCoins).Methods("POST")
r.HandleFunc("/view", userInfo.CoinBalance).Methods("GET")
r.HandleFunc("/redeem", userInfo.RedeemCoins).Methods("POST")
r.HandleFunc("/takeAction", userInfo.TakeAction).Methods("POST")
r.HandleFunc("/destroy", userInfo.DestroyGraduatingBatchAccounts).Methods("POST")
log.Println("Starting Server...!")
log.Fatal(http.ListenAndServe(":8080", r))
}
/*
//To check users in database
db, err := sql.Open("sqlite3", "./user_info.db")
userInfo.CheckError(err)
user := userInfo.FromSQLite(db)
users := user.Get();
fmt.Println(users)
*/