-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.ts
45 lines (42 loc) · 1.11 KB
/
app.ts
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
import { serve } from "https://deno.land/[email protected]/http/server.ts";
import { Hono } from "https://deno.land/x/[email protected]/mod.ts";
import {
getAlbum,
getAllAlbums,
getAllStarsAlbums,
getCinderellaGirlsAlbums,
getFiveStarsAlbum,
getMillionLiveAlbums,
getShinyColorsAlbums,
getSideMAlbums,
} from "./src/controllers/api.ts";
const app = new Hono();
app.get("/", (c) => {
return c.redirect("https://github.com/lonsagisawa/stream-api.kitahina.co");
});
app.get("/album", (c) => {
return c.json(getAllAlbums());
});
app.get("/album/allstars", (c) => {
return c.json(getAllStarsAlbums());
});
app.get("/album/cinderellagirls", (c) => {
return c.json(getCinderellaGirlsAlbums());
});
app.get("/album/millionlive", (c) => {
return c.json(getMillionLiveAlbums());
});
app.get("/album/sidem", (c) => {
return c.json(getSideMAlbums());
});
app.get("/album/shinycolors", (c) => {
return c.json(getShinyColorsAlbums());
});
app.get("/album/fivestars", (c) => {
return c.json(getFiveStarsAlbum());
});
app.get("/album/:id", (c) => {
const id = c.req.param("id");
return c.json(getAlbum(id));
});
serve(app.fetch);