I'm currently working on an application built with Express (Node.js) and I want to know what is the smartest way to handle different robots.txt for different environments (development, production).
This is what I have right now but I'm not convinced by the solution, I think it is dirty:
app.get '/robots.txt', (req, res) ->
res.set 'Content-Type', 'text/plain'
if app.settings.env == 'production'
res.send 'User-agent: *
Disallow: /signin
Disallow: /signup
Disallow: /signout
Sitemap: /sitemap.xml'
else
res.send 'User-agent: *
Disallow: /'
(NB: it is CoffeeScript)
There should be a better way. How would you do it?
Thank you.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…