Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

Treehouse

Node.js Basics Course

via Treehouse

Overview

In this course we will create two command line applications using the popular server-side JavaScript platform Node.js.

We'll be creating an application to retrieve a student's Treehouse profile information and weather information based on a zip code.

What you'll learn

  • Write command line applications in Node.js
  • Talk to an API with Node.js
  • Organize your code with modules
  • Deal with streams
  • Handle errors

Syllabus

Introduction to Node.js

Node.js is a JavaScript environment that allows you to perform a multitude of tasks and build all sorts of exciting applications.

In this section we'll discuss what Node is, why you'd use it and how to use it.

Chevron 7 steps
  • Overview

    3:19

  • Hello World

    5:36

  • The Console

    3 objectives

  • JavaScript without the Browser

    2:22

  • Why use Node.js?

    3:11

  • Finding Help as a Node.js Developer

    7:15

  • Review Introduction to Node.js

    10 questions

Building a Command Line Application

Node.js can be used to make all sorts of applications. In this section we'll build our project, a command-line application to retrieve student's profile information from the Treehouse API.

Chevron 10 steps
  • Planning Our Project

    6:44

  • System Events

    1:09

  • Making a GET Request with https

    5:46

  • Making a GET Request with https

    4 objectives

  • Getting the Response Body

    4:07

  • Getting the Response Body

    2 objectives

  • Parsing JSON

    2:13

  • Parsing JSON

    1 objective

  • Capturing Command Line Arguments

    5:55

  • Command Line Arguments

    2 questions

  • Extra Credit

    If you're done adding additional functionality to this project, why not create a command line application that takes a Zip Code or Postal Code and it retrieves the forecast for today.

    For example:

    node forecast.js 90210

    Forecast.io has an API you could use.

Handling Errors in Node

Handling errors is an essential part of developing an application. If you expect other people to use your code, it's vital to handle every situation that could go wrong.

Chevron 8 steps
  • Handling the Error Event in Node

    6:20

  • Handling Errors in Node

    3 objectives

  • Handling Parsing Errors with try and catch

    3:28

  • Using try and catch

    2 objectives

  • Handling Status Code Errors

    4:17

  • Handling Parsing and Status Code Errors

    3 questions

  • Organizing Your Code with require

    3:49

  • Organizing Your Code with require

    3 questions

Create a Command Line Weather Application

In this final stage you'll use everything you've learned so far in creating a command line application with Node.js to create a second application that connects to a weather API and display information based on a zip code or other user input.

Chevron 5 steps
  • Project Overview

    1:26

  • Retrieving Data - Solution

    2:15

  • Parsing Data and Printing - Solution

    1:14

  • Handling Errors - Solution

    2:34

  • Node.js Basics Review

    10 questions

  • Extra Credit

    Create a stock application that prints out the current share price...

    node app.js APPL 115.97

    ...or create a currency converter application.

    node app.js 100 usd in gbp 81.37

Reviews

Start your review of Node.js Basics Course

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.