Gabriele Ferro Home

Well begun is half done

Day 77: 07 November 2020

"Well begun is half done"

Aristotle

freeCodeCamp

I have started the fifth project of freeCodeCamp for the JavaScript Algorithms and Data Structure Certification.

JavaScript Algorithms and Data Structures Projects: Cash Register

There is a lot of repeated code because I tried to write an immediate solution that would allow me to pass the tests and I did not do any refactoring.

For the moment the last two tests fail.

OpenClassRooms

With a surge of enthusiasm, I also started the sixth OpenClassRooms project!

This project is about backend programming, so server side.

On the backend programming I have vague memories of a training I did in Sicily on the LAMP stack.

I used Linux, Apache, MySQL and PHP to create my web pages back in 2008.

Today I find myself using the MEAN stack: MongoDB, Express, Angular and Node.js

The huge advantage is that in this way, I use the same programming language (JavaScript) for both the frontend and backend. Also, it seems to me much easier to write queries to our database in JavaScript than the PHP + SQL combination.

**Today’s Progress:**

I start to work right away.

I download the document containing the project specifications and clone the frontend repository...

on the terminal I launch

npm install

Good start!

Happy accidents, nothing insurmountable:

  • Missing the python version 2.7 in my PC (I wonder why it needs it);
  • The last version of node-sass I had installed was not compatible so I had to uninstall it to be able to put the previous version;
  • Many packages have vulnerabilities.

Once I have solved these incompatibilities, I run the command

npm start

and visiting the localhost:4200 address the browser FINALLY opens the frontend page.

Perfect. I leave the terminal open with npm start running and I start write the code for the backend.

I create a folder that will contain my backend, I open it and launch the terminal from VSCode:

I initialize the package.json file by running npm init and change the default name index.js to server.js

I start a local Git repository by writing git init

In order to avoid having to close the process and rewrite "node server" in the terminal for every change, I install nodemon and other useful JavaScript modules like express, body-parser and mongoose.

Ended the backend configuration phase, I create the file server.js

And then I write the code of app.js and the schema that will be used as template.

I Played a few hours with the code and Postman.

With enormous satisfaction at 3 a.m. I make the first push on GitHub.

...and I immediately receive an email on my phone...who the hell is GitGuardian?!?!

Looks like, as a real beginner, I just made public my username & password combination for mongoDB.

Compliments Gabriele...

Delete GitHub repo.

Goodnight.

**Thoughts:**

I have to ask my mentor a way to get around this problem, because the project must be made public on GitHub to be delivered… But I don't think I should leave my username and password public…

**Update!**

freeCodeCamp got the answer: "Use the .env File"

**Link to tweet:**

[twitter-follow screen_name='20Gabriele20']

July 2024
MTWTFSS
1234567
891011121314
15161718192021
22232425262728
293031 

Archives

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