Gabriele Ferro Home

Optimized my project

Day 79: 10 November 2020

**Today’s Progress:**


I continued to code the sixth OpenClassRooms project.

I have coded the schema, the controller and the routes for the user account signup and login.

bcrypt and moongose-unique-validator (downloaded via npm) were the necessary packages to solve this task.

I also have optimized and arranged the structure of the project, in this way the routing logic is separate from the functions.

We have now:

  • All the schemas defining our database entries are inside the models folder;
  • All the functions that will be exported are now in the controllers folder and they require the appropriate schema;
  • All the routing functions are now methods of the Router object and they use our controllers functions
  • app.js now use our routes, allows the database connection and set the header.


I still can't dynamically compose a valid POST request. If instead I create an ad-hoc object that contains all the necessary fields, then the POST request works.

This is driving me crazy.

In order to fill my gaps, I have started reading The Express Handbook.

**Link to tweet:**

[twitter-follow screen_name='20Gabriele20']

June 2024


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