Skip to content

Instantly share code, notes, and snippets.

@rogerwschmidt
Last active July 17, 2017 18:31
Show Gist options
  • Select an option

  • Save rogerwschmidt/2ce45a69580dbcdb937187b7e6eb7330 to your computer and use it in GitHub Desktop.

Select an option

Save rogerwschmidt/2ce45a69580dbcdb937187b7e6eb7330 to your computer and use it in GitHub Desktop.

Intro to Node Instructor Notes

Objectives

  • Describe what Node.js is.
  • Explain why Node.js is important.
  • Upgrade Node.js to the latest version.
  • Run JavaScript code using the Node.js REPL.
  • Run JavaScript code using the Node.js interpreter.
  • Describe what I/O is.
  • Describe what the two ways to perform I/O are.
  • Use the fs and path modules to interact with the filesystem.

What is Node.js?

Turn to your neighbor and describe what Node.js is. Be prepared to share your answer with the class.

Why is Node.js important?

Turn to your neighbor and describe why Node.js is important. Be prepared to share your answer with the class.

How do I upgrade Node.js?

Make sure that Node is upgraded.

brew update
brew outdated
brew upgrade node
brew cleanup

You can check the version of Node.js by running the following command.

node -v

How do you run Javascript code in the REPL?

Do a simple addition in the Javascript REPL.

How do you run Javascript code in the interpreter?

In a file named hello.js, add the following code:

console.log(1 + 2);

Run the file by using the following command:

node hello.js

What is I/O?

Turn to your neighbor and describe what I/O is. Be prepared to share your answer with the class.

What are the two ways to perform I/O?

In a slate, write down what the two ways of performing I/O are.

Use the fs and path modules to interact with the filesystem.

Follow the instructions in the How do you use the fs and path modules to interact with the filesystem? section

Strech goal

  • Given the commands read and create, add a new command that prints out the number of guests.
  • Add a check so that create does not add duplicate names.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment