Skip to content
Advertisement

Node.js – “TypeError – res.setHeader is not a function”

I’m trying to load JSON from a URL to a variable and send it back to the client’s javascript

JavaScript

Every time I run the code the server says that res.setHeader isn’t a function and the rest breaks.

Advertisement

Answer

Both post and getJSON callbacks have same res variable name. Try this:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement