Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Node.js Basics 2017 Building a Command Line Application Making a GET Request with https

Sebastian Jørgensen
Sebastian Jørgensen
504 Points

im supposed to do the following task: On a new line, call the get method on the https object you created.

I cant seem to get it to work. it keeps saying there is an unexpected token on line 4

app.js
const https = require('https');


https.get(`https://teamtreehouse.com/chalkers.json`);

2 Answers

Lucian Rotari
Lucian Rotari
12,007 Points
const https = require('https');

https.get('https://teamtreehouse.com/chalkers.json');

try with quotation marks

From what I can found, instead of https.get , it should be $.get . Per W3schools, the syntax is:

$.get(URL,data,function(data,status,xhr),dataType)

If you want to specify HTML, it looks like it would go on the dataType field. I could be wrong, but hopefully this at least puts you in the correct direction.