Awesome Open Source
Awesome Open Source

Intro to Nodejs

Scott Moss & Frontend Masters

Resources

Course

Thanks for taking the Introduction to Node.js course -- the course has two parts: slides and exercises. The slides describe the exercises in detail. Each exercise have a folder.

Exercises

Installing Node

Install node with node version manager (NVM). NVM was created by the community and not the Nodejs foundation. However, it is the recommended approach. After installing nvm, use nvm to install the lates version of Nodejs, which at this time is 10 and set it to the default version

nvm install node # node is an alias for the latest version
nvm alias default node

If this fails, or you want to install nodejs from nodejs source, then go here

Important: After installing node, please run npm install i or npm install to install the dependencies located in the package.json file (utilized in future exercises).

Modules (node vs browser)

  • location - exercises/modules
  • commands
    • test - npx jest

This exercise will have you convert some JavaScript written for the browser, so that it works with node.

  • [ ] checkout to start branch
  • [ ] check the README on how to run test (will talk later about that command)
  • [ ] fix and convert the 3 js files in the exercises/modules/browser to Nodejs JavaScript and place them in exercises/modules/node
  • [ ] ensure all tests pass by running test command again

CLI (npm)

  • location - exercises/cli
  • commands
    • new - node exercises/cli/index.js new
    • list - node exercises/cli/index.js list

You'll be creating a CLI program that saves and retrieves contacts from and address book. The program is partially there, however, you must install some remote modules, and use the fileSystem to get some things to work.

  • [ ] install all remote modules (hint: use npm)
  • [ ] check the README on how to run your CLI
  • [ ] Fix the CLI so that the "new" command works by saving contacts to contacts.json
  • [ ] Fix the CLI so that the "list" command works by listing all contacts and allowing you to select one, the prints out the selected contact

API (async code)

  • location - exercises/api
  • commands
    • start the server - node exercises/api/server.js

You'll be refacoring and fixing a simple static asset server. The server uses blocking sync code and crashes whenever a request comes in that is asking for an asset that is not found. Neither of those are desirable. You'll also have to teach the server how to server the assets it has in the assets folder.

  • [ ] install all remote modules (hint: use npm)
  • [ ] check the README on how to run your server
  • [ ] refactor the sync file reading code to be async with a callback, promise, or async await
  • [ ] prevent the server from crashing when an assets is not found. Instead, respond with a 404 status code
  • [ ] create some sort of router logic to handle incoming requests for assets

Debugging & Testing

  • location - exercises/testing
  • commands
    • start the server - node exercises/testing/index.js
    • test - npm test or yarn test or npx jest

You have to debug and track down some issues in a small app. Use your logging and inspector to find them. Try and fix them, once you do, write some test to make sure it stays fixed πŸ‘ŒπŸΎπŸ˜ŽπŸ’―

  • [ ] checkout to start branch
  • [ ] check the README on how to execute this program and run test
  • [ ] there are 3 bugs, find them and fix them
  • [ ] write some unit test with Jest to make sure those bugs stay fixed. Refactor the code if you have to

Sharing and Deploying

Deploy one of the exercises to heroku (server) or npm (cli)


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
javascript (67,507)Β 
nodejs (3,585)Β 
node (940)Β 
exercises (36)Β 

Find Open Source By Browsing 7,000 Topics Across 59 Categories

Advertising πŸ“¦Β 10
All Projects
Application Programming Interfaces πŸ“¦Β 124
Applications πŸ“¦Β 192
Artificial Intelligence πŸ“¦Β 78
Blockchain πŸ“¦Β 73
Build Tools πŸ“¦Β 113
Cloud Computing πŸ“¦Β 80
Code Quality πŸ“¦Β 28
Collaboration πŸ“¦Β 32
Command Line Interface πŸ“¦Β 49
Community πŸ“¦Β 83
Companies πŸ“¦Β 60
Compilers πŸ“¦Β 63
Computer Science πŸ“¦Β 80
Configuration Management πŸ“¦Β 42
Content Management πŸ“¦Β 175
Control Flow πŸ“¦Β 213
Data Formats πŸ“¦Β 78
Data Processing πŸ“¦Β 276
Data Storage πŸ“¦Β 135
Economics πŸ“¦Β 64
Frameworks πŸ“¦Β 215
Games πŸ“¦Β 129
Graphics πŸ“¦Β 110
Hardware πŸ“¦Β 152
Integrated Development Environments πŸ“¦Β 49
Learning Resources πŸ“¦Β 166
Legal πŸ“¦Β 29
Libraries πŸ“¦Β 129
Lists Of Projects πŸ“¦Β 22
Machine Learning πŸ“¦Β 347
Mapping πŸ“¦Β 64
Marketing πŸ“¦Β 15
Mathematics πŸ“¦Β 55
Media πŸ“¦Β 239
Messaging πŸ“¦Β 98
Networking πŸ“¦Β 315
Operating Systems πŸ“¦Β 89
Operations πŸ“¦Β 121
Package Managers πŸ“¦Β 55
Programming Languages πŸ“¦Β 245
Runtime Environments πŸ“¦Β 100
Science πŸ“¦Β 42
Security πŸ“¦Β 396
Social Media πŸ“¦Β 27
Software Architecture πŸ“¦Β 72
Software Development πŸ“¦Β 72
Software Performance πŸ“¦Β 58
Software Quality πŸ“¦Β 133
Text Editors πŸ“¦Β 49
Text Processing πŸ“¦Β 136
User Interface πŸ“¦Β 330
User Interface Components πŸ“¦Β 514
Version Control πŸ“¦Β 30
Virtualization πŸ“¦Β 71
Web Browsers πŸ“¦Β 42
Web Servers πŸ“¦Β 26
Web User Interface πŸ“¦Β 210