diff --git a/functions/robots.txt.ts b/functions/robots.txt.ts new file mode 100644 index 0000000..f3511ff --- /dev/null +++ b/functions/robots.txt.ts @@ -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); + } +}