Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a590c8e

Browse files
committed
implement more endpoints
1 parent ef4aabe commit a590c8e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

‎http/api/v1/room.go‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,28 @@ func GetPlayers(ctx *fiber.Ctx) {
2222
if err != nil {
2323
fmt.Println(err)
2424
}
25+
}
26+
27+
func GetRoom(ctx *fiber.Ctx) {
28+
r, ok := room.Rooms[ctx.Params("id")]
29+
if !ok {
30+
err := ctx.Status(404).JSON(controller.DefaultResponse {
31+
Message: controller.NotFound,
32+
})
33+
if err != nil {
34+
fmt.Println(err)
35+
}
36+
return
37+
}
38+
err := ctx.JSON(r)
39+
if err != nil {
40+
fmt.Println(err)
41+
}
42+
}
43+
44+
func GetRooms(ctx *fiber.Ctx) {
45+
err := ctx.JSON(room.Rooms)
46+
if err != nil {
47+
fmt.Println(err)
48+
}
2549
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /