-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
29 lines (25 loc) · 661 Bytes
/
main.go
File metadata and controls
29 lines (25 loc) · 661 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
28
29
package main
import (
"UserTransactionGame/handler"
"github.com/gorilla/mux"
"log"
"net/http"
"time"
)
func main() {
r := mux.NewRouter()
r.HandleFunc("/user/create", handler.UserCreate).Methods("POST")
r.HandleFunc("/user/get", handler.UserGet).Methods("POST")
r.HandleFunc("/user/deposit", handler.UserDeposit).Methods("POST")
r.HandleFunc("/transaction", handler.UserTransaction).Methods("POST")
srv := &http.Server{
Addr: "0.0.0.0:8080",
WriteTimeout: time.Second * 15,
ReadTimeout: time.Second * 15,
IdleTimeout: time.Second * 60,
Handler: r,
}
if err := srv.ListenAndServe(); err != nil {
log.Println(err)
}
}