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#
- Run existing JavaScript files on your computer
- Keep in mind that we are not longer in the browser, so any file that references the
documentglobal object will throw an error
- Keep in mind that we are not longer in the browser, so any file that references the
Exercise 2: Create a Node Server#
- Create a file named
app.js - Create a server, from the lecture code sample, and run the
app.jsfile to start the server - Open your browser to http://localhost:5000 to test the response