22 lines
420 B
TypeScript
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
|