on
First Day - Setting up my environment and watching intro videos on YouTube
Today I :
- Set up my environment
- Watched intro videos on APIs and Node.js
Setting up my Environement
I have set up a local GIT repository for my Back-End course work. I have also decided to use VS Code as my development environment.
My repository will have separate folders for the course assignments:
- coursework
- diary: I have set up a Hugo blog site to keep my learning diary.
- project
I will be skipping the Git tutorials as I have some Git experience from another course.
I have already set up Git on my machine. I made an initial commit to my new Git ropo, and pushed to GitHub.
Back-end
REST Intro
Watched this video on YouTube.
- Face book has a REST api. I tried the sample on the video, but I don’t get the same result. Instead, I’m getting an error saying An access token is required to request this resource. I have some idea what this means. Would need to make the request with an API client, such as Postman? I googled this document on using the Facebook Graph API; maybe I’ll have a loot at it later.
- The google maps api sample doesn’t work either, error message saying an API key is required for each request.
- Instagram API example is also outdated. Just realised I am watching a 2014 video.
- ProgrammableWeb is an API directory.
- OAuth is used to authenticate to many APIs.
NodeJS Tutorial
Project home page: NodeJs.org
This course uses version 12. I believe I have this version already installed on my machine.
% node --version
v0.12.7
Tutorial video. OK this is a long one…
Create an HTTP server from scratch without Express, then deploy to Heroku. Covers modules such as as path, url, fs, events.
Node is a JavaScript Runtime.
Recommended to know first:
- HTTP (status codes, headers, etc..)
- JSON
- Arrow Functions
- Promises
- MVC Pattern
Learned that the best use cases and types of projects for Node are those that are not CPU intensive:
- REST API & Microservices
- Realtime services (Chat, Live Updates)
- CRUD Apps (Blogs, Shopping carts, Social Networks)
- Tools & Utilities
- etc..
NPM - Node Package manager
- npm init Generates a package.json file
- Lists all dependencies
- Packages are stored in the node_modules folder
- npm install express Installs a package locally
- npm install -g nodemon Installs a package globally
The tutorial project
- Created a new folder
coursework/node_crash_course npm initnpm install uuid
Npm did not add the package dependencies in the package.json file. I tried with –save but nothing happens. I decided to update my npm .. but it didn’t work without updating node, too. I’ll probably have some problems later on as I am not using the recommended version 12. I don’t want to spend time on this right now. Watching this video is slow…
Dev dependencies
npm install -D nodemon
Created a .gitignore with folder node_modules. No need to check these into VCS. npm install will recreate the directory.