Gabriele Ferro Home

Optimized my project

Day 79: 10 November 2020

**Today’s Progress:**

OpenClassRooms

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.

**Thoughts:**

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
MTWTFSS
 12
3456789
10111213141516
17181920212223
24252627282930

Archives

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