Closed adamwong246 closed 8 years ago
Router.map ->
@route 'robots',
path: '/robots.txt'
where: 'server'
action: ->
@response.writeHead 200, { 'Content-Type': 'text/plain; charset=UTF-8' }
@response.write(robots.txt)
@response.end()
@route 'sitemap',
path: '/sitemap.xml'
where: 'server'
action: ->
@response.writeHead 200, { 'Content-Type': 'application/xml; charset=UTF-8' }
@response.write "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
siteMap = XmlBuilder.create('urlset')
_.each Router.routes, (e) ->
if e.options.siteMap
url = siteMap.ele('url')
loc = url.ele('loc', {}, e.url())
if e.options.siteMap.priority
url.ele('priority', {}, e.options.siteMap.priority)
if e.options.siteMap.priority
url.ele('changefreq', {}, e.options.siteMap.changefreq)
@response.write siteMap.toString()
@response.end()
We don't and won't support Server Side Routes. But you can use Picker. See: https://github.com/meteorhacks/picker
I'm in the process of migrating our old-fashioned iron-router+blaze app, to a more modern flow-router+react stack.
IronRouter handled server-side routing for exactly 2 routes- sitemap.xml and robots.txt. Neither of these routes do any view-rendering- they write to the response directly. So there's no blaze OR react used on the server.
So how do I accomplish the same with FlowRouter? From what I understand, 4.0 doesn't support blaze at all and I can't upgrade the whole view to react. I just want to change the router first.
Is this doable?