Skip to content
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.
/ node-practice Public archive

Repository created to record my practice learning NodeJs

License

Notifications You must be signed in to change notification settings

NicolasOmar/node-practice

Repository files navigation

Node Practice Repo Node Practice

Repository created to record my practice learning NodeJs with exercises based on the Udemy Course of Andrew Mead.

Table of contents

Status

  • Current repo's version is Node practice version
  • This course has been completed on 22/03/2020 - Certificate

Why it has not any updated dependencies?

After finishing its related Udemy course, I archive this repository and unarchive it when I start a new training and add a link in the Other practice repos section referring to its new repo. But I don't update any associated dependency due to technology changes during the years between each practice, and the produced code which works with the mentioned requirements.

Requirements

  • Node v10.16.3 or above
  • For fourth exercise only

Setup

After cloning the repo, go to the created folder and install the node packages.

git clone https://github.com/NicolasOmar/node-practice.git
cd node-practice
npm run setup-all

setup-all is the command to install all the projects, but if you want to do it one by one, you can change that last line for one of the following:

App Setup Command
All npm run setup-all
Notes npm run setup-notes
Weather console npm run setup-weather-console
Weather web npm run setup-weather-web
Task manager npm run setup-task-manager
Chat npm run setup-chat

How to run it

To use any app, you just have to enter into its folder and run any of the scripts listed on its 'package.json' file. Each command runs with the following structure:

npm run <command-name>

In case you want to run all available commands on a row, execute the following command:

npm start

Repo structure & what i learned in each exercise

  • Notes app (1-notes folder)
    • Export and import files
    • Npm packages management
    • Improve console prompts with chalk
    • Use commands with arguments with yargs
    • Handle JSON data
  • Weather console app (2-weather-console folder)
    • Understand API documentation to creater better HTTP requests using DarkSky and MapBox as examples
    • Handle API data with request
    • Callback pattern & abstraction
    • Object destructuring
  • Weather web app (3-weather-app folder)
    • Create a local server with express
    • Automate server updates with nodemon
    • Load dynamic & partial views with hbs and inject them data
    • Build a JSON HTTP endpoint (using files, packages and knowledge from exercise #2)
    • How to fetch data from the internal url (based on previous point) on a javascript file
    • Use user interaction (by a search form) to make API requests based on user data input and return a result
  • Task manager app (4-task-manager folder)
    • How to create a Mongo database and connect it in Node with mongodb
    • How to handle CRUD operations (Create, Read, Update & Delete) in a Mongo database
    • Improve Mongo CRUD operations using a Object-document mapper with mongoose
    • Improve Mongoose model validations with validator
    • Create a REST API structure
    • Use promise chaining to avoid callback nesting
    • How to use Async/Await functions
    • Use Mongoose middleware at Model and endpoint level
    • Use password encryption with bcryptjs
    • JWT (JSON Web Token) integration with jsonwebtoken
    • How to test API endpoints with Postman (learning about Requests, Collections and Environments)
    • Create documents relationships based on document´s ids, getting them by Model.populate and virtual fields
    • Use timestamps to record create and update dates
    • Add filtering, pagination and sorting in a GET endpoint
    • Upload files using Multer
    • Handle images in an endpoint and save them in a Mongo database
    • Use and implement environment variables with env-cmd
    • Unit testing with Jest
    • API requests Unit testing with supertest
  • Chat app (5-chat folder)
    • Create a project using WebSocket protocol with Socket.io
    • Emit and send events with data (from client to server and visceversa)
    • How to use Gelocation API and send location on a Google Maps link
    • Event acknowledgments
    • Render messages with Mustache
    • Associate users in different channels/rooms and handle messages for specific channels

Other practice repos

React Angular GraphQL Typescript HTML & CSS
React Practice Repo Angular Practice Repo GraphQL Practice Repo Typescript Practice Repo HTML and CSS Practice Repo