forked from ccc112a/ws112a
-
Notifications
You must be signed in to change notification settings - Fork 0
/
2.js
44 lines (36 loc) · 915 Bytes
/
2.js
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
import { Application, Router } from "https://deno.land/x/oak/mod.ts";
const app = new Application();
const router = new Router();
router.get("/", (ctx) => {
ctx.response.body = `
<html>
<body>
</body>
</html>`;
});
router.get("/nqu/", (ctx) => {
ctx.response.body = `
<html>
<body>
<a href="https://www.nqu.edu.tw/">NQU</a>
</body>
</html>`;
});
router.get("/nqu/csie/", (ctx) => {
ctx.response.body = `
<html>
<body>
<a href="https://csie.nqu.edu.tw/">NQU_CSIE</a>
</body>
</html>`;
});
router.get("/to/nqu/", (ctx) => {
ctx.response.redirect("https://www.nqu.edu.tw/");
});
router.get("/to/nqu/csie/", (ctx) => {
ctx.response.redirect("https://csie.nqu.edu.tw/");
});
app.use(router.routes());
app.use(router.allowedMethods());
console.log('Server started at: http://127.0.0.1:8000');
await app.listen({ port: 8000 });