(req, res, next)
| 4 | Disallow: /` |
| 5 | |
| 6 | export default function robots(req, res, next) { |
| 7 | if (req.path !== '/robots.txt') return next() |
| 8 | |
| 9 | res.type('text/plain') |
| 10 | |
| 11 | // only include robots.txt when it's our production domain and adding localhost for robots-txt.js test |
| 12 | if (req.hostname === 'docs.github.com' || req.hostname === '127.0.0.1') { |
| 13 | return res.send(defaultResponse) |
| 14 | } |
| 15 | |
| 16 | return res.send(disallowAll) |
| 17 | } |