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 trialJonathan Smith
18,196 PointsI dont understand the const http = require('http') or the const https = require('https') at the top of the file.
What exactly do these do? Do they pull in additional methods that can be called your javscript file? Also what is require() doing and what does the term mean in programming?
1 Answer
Steven Parker
231,275 PointsThe "require" function is unique to the node.js engine and not standard in JavaScript. It loads in another file as a module (sort of a "library"). And you're right, the purpose is normally to allow your program access to methods that are defined in that module.
Jonathan Smith
18,196 PointsJonathan Smith
18,196 PointsGreat Answer, Thanks You!!!