Skip to main content

Exercise: Node Intro

Objective#

Your objective is to practice running JavaScript files with the Node CLI.

Getting Started#

You will not be forking or cloning an exercise repo for this exercise. Rather, you will be running existing JavaScript files with the Node CLI, and creating a new file to create a simple server.

Steps#

Exercise 1: Run JavaScript Files in Node#

  1. Run existing JavaScript files on your computer
    • Keep in mind that we are not longer in the browser, so any file that references the document global object will throw an error

Exercise 2: Create a Node Server#

  1. Create a file named app.js
  2. Create a server, from the lecture code sample, and run the app.js file to start the server
  3. Open your browser to http://localhost:5000 to test the response