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 Build a Simple Dynamic Site with Node.js Creating a Simple Server in Node.js Preparing & Planning

Giovanni Dalla Rizza
Giovanni Dalla Rizza
10,633 Points

Help with Preparing & Planning

I'm on Node just for few days and this is the first time I write code server-side. Can someone could give me help explaining point 2 and 3 of solution procees?

Points are:

  1. handle HTTP route GET / and POST /
  2. handle HTTP route GET /:username

Thanks! Those lessons confuse me a little bit!:D

Here is my understanding

  1. HTTP is the structured text that both the server and the client is expecting. It is the language, or protocol, that everybody is agreeing to communicate with.

  2. GET and POST... these are the HTTP verbs (and methods) associated with what you are trying to do. Generally, when you submit a form, you are using POST. When you are retrieving information, you are using GET. There are others, but GET and POST are the most commonly used. http://www.restapitutorial.com/lessons/httpmethods.html

  3. The ROUTE is both the HTTP method (GET/POST) AND the full path. So... one route will be http://www.awesomeurl.com/ and another will be http://www.awesomeurl.com/myusername. Both of these will likely be GETs, but they will act differently based on the route. In this case, the first will display the home page. The second will display the results.