Learning while teaching — Pre-Class 1
Intro
Before we begin first we need to setup our environment. There is a couple things that must be done in order to proceed, some of them are required and some not. The ones that are not required are highly recommended because they can make your life easier. I’ll try my best to link tutorials about how to achieve each step of this setup but in general things are pretty straightforward, if you have some problems email me or contact me on Twitter and I’ll do my best to help you.
Step 1 — Install node.js
Yes, you do need node.js installed to learn node.js…
OS X
If you are a Mac user I highly recommend you installing brew first, just click on the link and follow the steps.
With brew
Go to terminal.app and type:
brew install node
Without brew
Instructions are available at https://nodejs.org/en/download/ although I highly recommend you to have brew installed on your Mac.
Linux
Just use your favorite package manager or go to https://nodejs.org/en/download/, if you have trouble or doubts, just google it ;).
Windows
At https://nodejs.org/en/download/ they have an Windows installer, not sure how it works but should be pretty straight forward.
Step 2 — Choose your IDE or Text editor
If you already use an IDE that supports node.js you are good to go, if not here are some good options of IDE and text editors:
Web Storm (Paid)
This is the best IDE (In my opinion) and totally worth the price.
- Interactive debug
- Code completion
- Unit Testing
- Lots of other (check their website)
https://www.jetbrains.com/webstorm/
Visual Studio Code (Free)
Microsoft and free? Yes! This is a free IDE form Microsoft, simple but quite useful and better yet, for all OS.
- Interactive debug
- Code completion
https://code.visualstudio.com/
VIM
If you don’t know VIM it’s better do some research, maybe it will not be your main editor but you will definitely use it at some point.
- Can do everything with plugins
Other Options
- Sublime (http://www.sublimetext.com)
- TextWrangler (http://www.barebones.com/products/textwrangler/)
- BBEdit (http://www.barebones.com/products/bbedit/)
- Visual Studio (https://www.visualstudio.com) *Windows Only
Nevertheless, google about IDEs or Text editors for your platform and find something that matches your needs and you feel comfortable with, having a good IDE or Text Editor and really knowing how to use it can make all the difference.
Step 3 — Write a Hello World!
Maybe it looks kind of stupid but if you can do this means that at least you have all installed correctly and know how to execute your code.
Open your IDE or text editor and just write this code:
console.log(“hello world”);
Save the file with whatever name do you want (use .js as extension). Open terminal.app go to folder where file was saved and type:
node filename
You should see:
hello world
And that is it, your environment is basically setup and your node is working.
;)