Web applications in React, Bootstrap, MongoDB, Express/Create a Node Express web server locally that connects to a MongoDB database

Installing Node.Js and Express Generator

 * 1) Node.Js is a Javascript framework that also allows you to write server-side code and therefore, in particular, allows you to create an Express web server. npm (short for Node Package Manager [2]) is the default package manager for the Node.js JavaScript runtime environment. It consists of a command line client, also called npm, and an online database of public and private packages, called the npm registry.
 * 2) Install Node.js on your PC from here: https://nodejs.org/
 * 3) In the terminal type:

to verify that both node and npm have been installed correctly on your system.


 * 4) Install the express-generator package via npm by typing in the terminal:


 * 5) Open the terminal in Documents and type:


 * 6) In the ItemsServer folder, type in the terminal:


 * 7) In the ItemsServer folder type in the terminal to start the server:


 * 8) In the browser at the link http://localhost:3000/ the message "Welcome to Express" will appear.A Node Express web server is done !

API REST and MONGOOSE
The requests that the client makes to the server are made through the REST API. For example, if you are making a GET request, you are asking the server to return a resource. If you make a POST request, the server is being asked to create a new resource. If you are making a PUT request, you are asking the server to update an existing resource. And if you issue a DELETE request, the server is being asked to delete the resource identified by the particular URI. The exchange of data between client and server takes place in JSON format, which represents the standard with which Javascript objects are built. For example, the URL http://localhost:3000/items/234 means that the client asks the server to act on item 234, on which it is possible to perform GET, PUT or DELETE operations. To implement REST API calls on the MongoDB database you need to install mongoose:


 * 1) In the ItemsServer folder open a terminal and type:


 * 2) Create a mongoose schema for the document items of the MongoDB database and insert it in the items.js file inside the models sub folder of the ItemServer folder


 * 3) In the subFolder routes of ItemServer, create the file itemRouter.js :


 * 4) Edit the app.js file in the ItemsServer folder :


 * 5) We created a Node Express web server that connects locally to a MongoDB database.