Skip to content

Commit 4dfd341

Browse files
committed
Add robots.txt
1 parent 4c6e0b5 commit 4dfd341

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

functions/robots.txt.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { StatusCodes } from 'http-status-codes';
2+
import type { RequestContext } from '../src/backend/context';
3+
import { error, response } from '../src/backend/utils';
4+
5+
export async function onRequest({ env }: RequestContext) {
6+
try {
7+
return response(StatusCodes.OK, 'User-agent: *\nDisallow: /', false);
8+
} catch (e: any) {
9+
console.error(e);
10+
return error(StatusCodes.INTERNAL_SERVER_ERROR, env.DEBUG && e?.message);
11+
}
12+
}

0 commit comments

Comments
 (0)