-
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) · 798 Bytes
/
main.go
File metadata and controls
27 lines (22 loc) · 798 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 (
"CATechDojo/controller/character"
"CATechDojo/controller/gacha"
"CATechDojo/controller/health"
"CATechDojo/controller/user"
"net/http"
"github.com/gorilla/mux"
)
func main() {
//NewRouter関数で*Router型の変数を定義
r := mux.NewRouter()
//MethodsメソッドでHTTPメソッドの種類を指定
r.HandleFunc("/health", health.HealthCheck).Methods("GET")
r.HandleFunc("/user", user.GetAll).Methods("GET")
r.HandleFunc("/user/get", user.GetUser).Methods("GET")
r.HandleFunc("/user/create", user.Create).Methods("POST")
r.HandleFunc("/user/update", user.ChangeName).Methods("PUT")
r.HandleFunc("/character/list", character.ShowUserCharacters).Methods("GET")
r.HandleFunc("/gacha/draw", gacha.Draw).Methods("GET")
http.ListenAndServe(":8080", r)
}