Gabriele Ferro Home

APIs and Microservices Course on freeCodeCamp!

Day 92: 3 December 2020

**Today’s Progress:**

After days spent studying Vue.js, today I started writing the draft of the presentation of my sixth OpenClassRooms project.

I will present it in a few weeks and looking at the code I have the impression that it was written by someone else.

I know this is not possible since I wrote it, but the Imposter Syndrome is strong.

So I resumed the freeCodeCamp path!

Since the 6th OpenClassRooms project is about creating a website API using Node.js / Express / MongoDB / Mongoose, the APIs & Microservices Certification on freeCodeCamp is just right for me!

APIs and Microservices Certification

I have completed 17 lessons and I already knew many things, but it is interesting to study the same topics from different sources because I can see the small nuances, the differences and especially for the presence of the Eureka Effect!

For example, freeCodeCamp suggests the use of a platform unknown to me: Repl.it

As the course starts from scratch, the first thing that is explained is the package.json file (a file that contains the project information) and how to customize it by adding: author name, description, keywords, license type, version and dependencies.

Semantic Versioning (SemVer) is explained, i.e. the meaning behind each version number.

For example: what version 3.12.4 means

Version numbers are separated by dots and are in the form:

MAJOR . MINOR . PATCH

Usually the MAJOR version introduces radical changes in the API that are not compatible with previous versions. While MINOR introduces new backward compatible features and PATCH are bugfixes.

Then the course continues by explaining how to allow dependencies to be updated using ~ (tilde) and ^ (caret).

Dependencies are external modules that are used in the project and are also called packages, but after all, they are nothing more than files written in JavaScript.

The following section is about the Express framework that acts as a link between Node.js and the frontend.

Express provides useful functions (also called methods) such as listen, use, get, post, delete to manage the routing of our application which is typically written in the form:

app.METHOD( PATH, HANDLER );

where PATH will be the route for example http://www.mywebsite.com/PATH

and HANDLER will be the callback (a JavaScript function) that will be executed by Express.

Usually the callback takes 3 parameters: the request, the answer and next (which will be a function that will call the next middleware). The middleware is one or more routes in cascade.

With these parameters we can manipulate the request, create a response or serve a static file like an HTML page.

In addition, we can import the images folder (or where the CSS is located) of the site by writing:

app.use(express.static(__dirname + "/images"));

The course proceeds explaining the importance of process.env and how the creation of a Global Node Object allows us for example not to disclose mongoDB username and password publicly on GitHub.

... right Gabriele? >_>

The last lesson I completed explains how to write a small logger. Much simpler and more interesting than I imagined!

I studied with passion and would have continued "to infinity and beyond!" but my eyes began to burn.

**Thoughts:**

For the moment I decided to put aside the study of Vue.js since I have to prepare the presentation for the sixth project. I will use it for the seventh and last project.

**Link to tweet:**

[twitter-follow screen_name='20Gabriele20']

February 2024
MTWTFSS
 1234
567891011
12131415161718
19202122232425
26272829 

Archives

Gabriele Ferro Home
Copyright © Ferro Gabriele. All rights reserved.