This repository has been archived by the owner on Feb 8, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
53 lines (41 loc) · 1.48 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
41
42
43
44
45
46
47
48
49
50
51
52
53
// Special thanks to dondish for helping me
package main
import (
"math/rand"
"net/http"
"os"
"strconv"
"github.com/gin-gonic/gin"
_ "github.com/joho/godotenv/autoload"
)
func setupRouter() *gin.Engine {
router := gin.Default()
var baseURL string
baseURL = "https://cdn.derpyenterprises.org"
router.GET("/", func(c *gin.Context) {
c.String(http.StatusOK, "hello world")
})
router.GET("/takagijson", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"url": baseURL + "/miku/takagi/image(" + strconv.Itoa(rand.Intn(48-1+1)+1) + ").jpeg"})
})
router.GET("/saojson", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"url": baseURL + "/miku/sao/image(" + strconv.Itoa(rand.Intn(32-1+1)+1) + ").jpeg"})
})
router.GET("/ddlcjson", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"url": baseURL + "/miku/ddlc/image(" + strconv.Itoa(rand.Intn(27-1+1)+1) + ").jpeg"})
})
router.GET("/konosubajson", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"url": baseURL + "/miku/konosuba/image(" + strconv.Itoa(rand.Intn(51-1+1)+1) + ").gif"})
})
router.GET("/lovelivejson", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"url": baseURL + "/miku/lovelive/image(" + strconv.Itoa(rand.Intn(103-1+1)+1) + ").gif"})
})
router.GET("/k_onjson", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"url": baseURL + "/miku/k_on/image(" + strconv.Itoa(rand.Intn(142-1+1)+1) + ").gif"})
})
return router
}
func main() {
router := setupRouter()
router.Run(os.Getenv("PORT"))
}