I am trying to parse a very simple csv file from yahoo finance. The resulting csv just has the current price of the stock. When I am running this I keep on getting this error. Ss there something off in my syntax ?
/tmp/de49fef0-c2fb-11e6-b1be-07e013ca5c3c/Node Application/app.js:6 https.get(endpoint, (response) => { ^ SyntaxError: Unexpected token > at Module._compile (module.js:437:25) at Object.Module._extensions..js (module.js:467:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.runMain (module.js:492:10) at process.startup.processNextTick.process._tickCallback (node.js:244:9)
var https = require('https')
var endpoint = "http://finance.yahoo.com/d/quotes.csv?s=AAPL&f=a"
var body = ""
https.get(endpoint, (response) => {
response.on('data', (chunk) => { body += chunk })
response.on('end', () => {
var data = JSON.parse(body)
console.log(data)})})