Learning Node.JS
This beautiful sunny weekend in London I decided to stay in and learnĀ āPostCSSā...there was mentions of modules and similarities now instead Iām learning Node.JS. I figured if, I can get a fundamental understanding of what it is and how it works exactly, Iāll be in better position to understand āPost CSSā...Ā
yeah...sounds about right.Ā
I have a basic understanding of javascript, very basic understanding of Terminal, and a basic understanding of Github. The hope is, that while learning Node.JS, Iāll be able to understand more of these other tools in my use of it during this experience.
Shout out to the book Iām using to guide me through the process!
āSams Teach Yourself Node.JS in 24 Hours by George Ornboā.Ā
Itās speaking my language in terms of my level of understanding, and satisfies the feeling of accomplishment by having you build something small every chapter using it. Iām starting to gain momentum going the first two chapters so I think this might be a good time to document my journey.Ā
I loaded my first server--relatively, pretty simple.Ā
Following the instructions on the book, I already had node dlād. I opened my Sublime Text Editor separately and saved the files under my computer name. This book was written a couple years ago, so when it came to the examples, I googled instead 2016 instructions from The Node Beginner and copied the coding from there vs from the book that has some ancient written texts on it, lol:
Modules
I have since moved on to familiarizing myself with the concept of modules and checked out the IRC database. Following the instructions of the book to also check them out via terminal--
(It scrolls for days)
While this gives me a sense of accomplishment, its mostly false as I still donāt get how they are used in context.Ā
I then used one for my own module called underscore--I think:
Terminal results after naming the file foo.js:Ā
Moving forward to JSON packages!
The next exercise had me open another file in the text editor and copy and paste ancient code--that would allow me to store all myĀ ādependencies and modules in one placeā. However, I believe it wasnāt updated or I didnāt fill in the info in the text editor, so this happened--
Fortunately, they are not deal breakers, but more like aĀ āheads up! this sucksā
Meh. Moving on! Exercises:
I got through the workshop and exercises at the end of this second chapter. Used npm search to search for a template engineĀ
Ā Ā Ā npm search template engine
...A bazillion packages displayed on the terminal.
Then installedĀ ācoffee-scriptā using the search first to see the options. Then got stuck at installingĀ āexpressā---
Problem: npm install -g express -- the -g should install it globally ( so it can be accessed from anywhere, not just a specific project file). By default, when you install modules, itās stored locally in aĀ ānode-modulesā file. Of which, I noticed, despite my use of -g, it kept being stored under:
^Stored in node_modules...so then when I try to call it from outside the folder, I get this:
GoogledĀ ācanāt install express globallyā. Landed on this Stack Overflow Page that had the answer: Ā sudo npm install -g express-generator
...and now it works!
Next up: Learning the Context of Node.JS: Chapter 3: What is Node.JS Used for














