Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.