Can i send JSON data from server to client through headers?

Can i send JSON data from server to client through headers?
0

#1

I have some data (which were retrieved using node.js ) that I have to use in the client side, particularly with the view.
Can I do that using (non verbatim):

res.sendFile(*html file*, *JSON data i need to send*)

?
It does work, but I want to know why or why not this is a good idea.
also, I’ve learned to do that from here


#2

It’s a hack. You’re using headers for something they’re not intended for, and it’s an inefficient way to get your data to the view. It sounds like you want to do some server side rendering, so why not create a template and use res.render?