This video is available to students only

How to Run Node.js With JavaScript Code

In this lesson, we'll use Node to run a simple JavaScript file on the server.

Running JavaScript with Node#

We have our Visual Studio Code Editor and our terminal available to us in our workspace.

To begin, we'll start with an empty folder labeled tinyhouse_v1/ in our editor workspace.

tinyhouse_v1/ would be the directory where we build the app for the first part of our course. To get things started we're going to create a subfolder called server within the tinyhouse_v1/ project that would host the server portion of our app. We'll also go ahead and have an index.js file be created within this server subfolder.

The node command#

For our very first attempt, we're going to see how we could use node to run some JavaScript code and the first code we're going to write is a simple console.log message.

Start a new discussion. All notification go to the author.