brf/server/handlers/robots.ts
2025-12-13 21:12:08 +01:00

22 lines
420 B
TypeScript

import type { RouteHandler } from 'fastify'
import env from '../env.ts'
const CONTENT = {
development: `
User-agent: *
Disallow: /
`,
production: `
User-agent: *
Disallow: /admin
`,
}
const contents = (CONTENT[env.NODE_ENV as 'development' | 'production'] || CONTENT.development).trim()
const robots: RouteHandler = (_request, reply) => {
return reply.type('text/plain').send(contents)
}
export default robots