Wednesday, 7 June 2017

How can I render xml using Koa.js?

It seems like html breaks if I just render xml text using ctx.body because everything goes into body element not as raw xml. I read all the documentation but couldn't find proper response function for rendering xml.

This is my code and how it looks like on browser!

router.get('/:tag', async (ctx, next) => 
    (ctx.body = await rssGenerator(ctx.params.tag)))

enter image description here



via Phillip YS

No comments:

Post a Comment