Gabriele Ferro Home

CRUD

Day 78: 09 November 2020

For the moment I pause the freeCodeCamp path to focus exclusively on OpenClassRooms.

**Today’s Progress:**

OpenClassRooms

The project in question is a database of sauces that are entered by the user and voted by the community.

The frontend part of the project has already been written and this time I will take care of the backend.

Last time I had configured the Node.js, Express, MongoDB system and prepared the basic code structure to launch a server instance and to test it with Postman.

I had also prepared the scheme used to define the "Sauce" object.

For the moment all the fields are not required.

The next step is to implement the CRUD:

  • Create (post)
  • Read (get)
  • Update (put)
  • Delete (delete)

So I need to create functions that allow the manipulation of our database.

These functions are called routes and that's what I tried to code today.

I still cannot figure out how to craft the post request to create a sauce, and for this reason there are several attempts in my code. If we insert an object created "ad-hoc", and therefore without considering the form, then the sauce is correctly inserted in the database (the sauce on the left).

If we modify the sauce using the form, it is modified and the database is updated.

Now we can retrieve the list of all the sauces, and make a GET request for a specific sauce.

Also, it is possible to delete a specific sauce from our database.

app.js header and routes

**Thoughts:**

I'm almost finished!!!

I have to deliver 2 projects, follow 2 courses and...

At the end of your training and the validation of your skills by a jury, you will be able to obtain the "Web Developer" certificate.
You will also be able to obtain this title registered in the National Directory of Professional Certifications, level 5 (Bac+2) on the French and European Qualifications Framework, provided that you validate the necessary prerequisites.

**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.