Skip to content

Commit

Permalink
Add robots.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
james-pre committed Jan 2, 2025
1 parent 4c6e0b5 commit 4dfd341
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions functions/robots.txt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { StatusCodes } from 'http-status-codes';
import type { RequestContext } from '../src/backend/context';
import { error, response } from '../src/backend/utils';

export async function onRequest({ env }: RequestContext) {
try {
return response(StatusCodes.OK, 'User-agent: *\nDisallow: /', false);
} catch (e: any) {
console.error(e);
return error(StatusCodes.INTERNAL_SERVER_ERROR, env.DEBUG && e?.message);
}
}

0 comments on commit 4dfd341

Please sign in to comment.