Skip to content

Commit a56d8a1

Browse files
authored
feat: add robots.txt (#13)
* feat: add robots.txt * chore: update deno task runner
1 parent dd7ed44 commit a56d8a1

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

deno.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"tasks": {
3-
"start": "deno run --env --unstable-kv --allow-net --allow-env src/main.ts",
4-
"dev": "deno run --watch --env --unstable-kv --allow-net --allow-env src/main.ts"
3+
"start": "deno run --env --unstable-kv --allow-net --allow-env --allow-read src/main.ts",
4+
"dev": "deno run --watch --env --unstable-kv --allow-net --allow-env --allow-read src/main.ts"
55
},
66
"imports": {
77
"@hono/zod-validator": "npm:@hono/zod-validator@^0.2.2",

public/robots.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
User-Agent: *
2+
Disallow: /

src/routes/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Hono } from "hono";
2+
import { serveStatic } from "hono/deno";
23

34
import { home, redirect } from "../controllers/index.ts";
45
import { sendAccessLog } from "../services/log.ts";
@@ -17,6 +18,7 @@ app.use(async (c, next) => {
1718
}
1819
}
1920
});
21+
app.use("/robots.txt", serveStatic({ path: "public/robots.txt" }));
2022

2123
app.get("/", home);
2224
app.get("/:param", redirect);

0 commit comments

Comments
 (0)