Create a Web App with React, MongoDB, Express and Nodejs | Raymundo CH | Skillshare

Playback Speed


  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Create a Web App with React, MongoDB, Express and Nodejs

teacher avatar Raymundo CH

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

81 Lessons (15h 35m)
    • 1. Welcome to the course on MERN stack

      14:15
    • 2. Create a 'Hello World' web app with Nodejs and Express

      13:56
    • 3. Configure an static web server with Nodejs and Express

      5:33
    • 4. Creating the routes of the REST API

      13:56
    • 5. Set up a database with MongoDB Atlas

      10:47
    • 6. Connection to MongoDB Atlas

      13:33
    • 7. Creating a model with Mongoose

      11:24
    • 8. Body Parser

      5:10
    • 9. Using a REST Client

      4:35
    • 10. REST API : Creating an invoice

      13:30
    • 11. Testing REST API : Creating an invoice

      6:53
    • 12. REST API : Reading all invoices

      13:33
    • 13. REST API : Reading one invoice

      8:47
    • 14. Testing REST API : Reading one invoice

      13:33
    • 15. Nodemon

      7:00
    • 16. REST API : Deleting invoices

      11:38
    • 17. REST API : Updating invoices

      12:35
    • 18. Testing REST API : Updating invoices

      7:36
    • 19. Webpack: Installing dependencies

      11:22
    • 20. Webpack: Creating configuration file

      13:36
    • 21. Webpack: Explaining configuration file

      8:56
    • 22. React : Creating the first web app

      13:16
    • 23. Setting up a Router with React

      14:43
    • 24. Testing the Router

      14:49
    • 25. Saving Components into different files

      8:31
    • 26. Setting up and testing React Bootstrap

      8:04
    • 27. Creating the first text field with React

      9:59
    • 28. Creating a text field for the seller's name

      14:34
    • 29. Testing seller's name text field

      7:31
    • 30. Setting up four text fields

      12:14
    • 31. Testing four text fields

      14:15
    • 32. Setting up a textarea

      13:33
    • 33. Testing textarea

      7:48
    • 34. Create another textarea

      9:20
    • 35. React Component: Displaying items and prices

      11:30
    • 36. Testing React Component: Displaying items and prices

      8:35
    • 37. React Component: Final Price

      14:32
    • 38. React Component : Adding new item and price

      12:52
    • 39. React Component : Adding new item

      13:10
    • 40. Testing React Component : Adding new item

      12:32
    • 41. React Button : Creating a new invoice

      12:14
    • 42. Saving invoice's information into an object

      10:01
    • 43. MongoDB: Saving information

      14:19
    • 44. React : Setting up a dialog box

      13:28
    • 45. React: Testing the dialog box

      12:01
    • 46. React: Creating a table

      13:39
    • 47. React : Custom Card Component

      13:37
    • 48. Create invoice Layout

      7:22
    • 49. MongoDB: Reading invoices

      12:51
    • 50. Getting Ids and Descriptions

      13:58
    • 51. Table of invoices

      14:01
    • 52. React: Testing invoices table

      13:53
    • 53. React: Testing how to delete an invoice

      12:55
    • 54. React: Testing how to delete an invoice

      14:36
    • 55. React: View invoice button

      13:32
    • 56. React Router : Passing parameters to routes

      14:27
    • 57. React: Single invoice component

      10:26
    • 58. React: Single invoice layout

      14:28
    • 59. MongoDB : Reading information

      12:58
    • 60. Error Handling with React

      10:01
    • 61. Crafting the invoice

      14:09
    • 62. MongoDB: Displaying information

      8:34
    • 63. React: Adding navigation button

      10:36
    • 64. Improving invoice layout

      12:53
    • 65. React : Creating Update Invoice Button

      11:32
    • 66. Testing the Update button

      6:26
    • 67. React Component: Update invoice

      10:36
    • 68. Handling Errors: Updating invoice

      14:51
    • 69. Using State Variables

      6:06
    • 70. Crafting Update Form

      13:40
    • 71. React : Updating invoice form

      14:36
    • 72. Adding information to Form

      14:29
    • 73. Fixing some errors

      4:13
    • 74. Updating form: Fetch promise

      14:29
    • 75. React : Dialog Box

      14:35
    • 76. Updating invoice : Last improvements

      14:18
    • 77. Navigation Button: Updating invocie

      6:13
    • 78. Homepage

      14:37
    • 79. Adding some navigation buttons

      13:52
    • 80. Production code with Webpack

      6:05
    • 81. Testing App

      9:41
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

552

Students

--

Projects

About This Class

This course shows you how to create a web app by usign the MERN stack. This course is a  great choice if you want to learn these technologies in a few hours. The videotutorial is split into small videos. All the videos are easy to understand. The next listing shows some of the topics that are covered during the course :

  • Setting up React from scratch by using Webpack
  • Making a connection to MongoDB with Nodejs and Express
  • Creating a Model with Mongoose
  • Handling forms with React
  • Styling React app with React-Bootstrap
  • Creating a Router
  • Bundling code with React
  • Creating a REST API from scratch
  • Using Javascript Promises
  • And much more...

Meet Your Teacher

Teacher Profile Image

Raymundo CH

Teacher

Hello, I'm Raymundo. I like web development because it represents a challenge all the time. Learning programming languages is fun and is a challenge for the mind. 

Since I heard about NodeJs some years ago I felt curious because they said it was possible to create a complete web app using javascript solely. It was very interesting. 

At first it was hard to understand NodeJs because the way it works differs a lot from the traditional approach, even the way to deploy and app changes  and the companies that store your app offer a set of different and weird  products!! so it was an adventure for me.

Nowadays I've understood NodeJs and I'm here to share with you my knowledge in a simple way. I hope you enjoy my videotutorials and send me feedback plea... See full profile

Class Ratings

Expectations Met?
  • Exceeded!
    0%
  • Yes
    0%
  • Somewhat
    0%
  • Not really
    0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. Welcome to the course on MERN stack: welcome, guys to these Be a tutorial on react My body be express And Algeria? Yes. On these big a tutorial, you are going to create a web application by you seen fullest Ackman. But you want to learn react mobile BB Express A No J guess in a few hours Do you want to learn how to create a with application by you seen fullest that man, If your answer is just, then this course is for you. Well, thes course contains two different sections. Okay, on the first section, you are going to create the back end off the application in order to create the back end off the obligation you are going to use Node.js Express and Mongo DB on the first section of these tutorial, you're going to create your first with application using express and no J. Guess you are going to handle. Is that files with Express on? No JDS as well, and you are going to set up arrest 80 I on this on the first section off these course, you're going to create a database, but you see mongo db you're going to understand how to save information into the data ways by using arrest. 80 I and you are going to understand how to read information from the database by you seen Arrest a P I as well. On the first section off these bills tutorial, you are going toe toe. Understand how? Toe date information. Uh, that is a start into the batteries by using arrest, FBI and you are going to learn how to delete information from the batteries. But you think arrest a B I as well. On the second section off these course, you are going to create the front end off the application in order to create the user interface off the application you're going to use react on the second section off this course you are going to configure react by using with back, and you are going to understand how to handle roads will react on the second section off the scores. You're going to handle the farm in boot off the user interface. Um, OK, you're going to you're going to understand how to handle the form input, wheat, react on this section. You are going to understand how to handle evens. We react. Andi, you're going toe. Understand? How toe have CSS styles do with applications built with react on the second section off these course, you are going to, um you're going to be able you're going to be able tow. Well, on the second section off these course, I am going to explain to you how toe make a react application. Establish communication week theorist A B I by you seen javascript promises. Okay, So you are going to understand how you react communicates We'd arrest a P i by you seen jealous creep promises. And you're going toe. Um, you're going to create react, react, react components with glasses and functions. You are going to understand how to handle a state. Variables will react on a much more. Okay, guys will now, as you can see on the screen. Well, as you can see, um, on the screen, we I have the the Web application that you are going to create during this course. Okay, this is the web application that you are going to create on these course. Well, now I want to show you how these with application works. As you can see, the name off the web application is in boys generator. Okay, so on the home page. I have two good ones where good. Only one button says I create a new invoice on the other. One says, Show all invoices. So I'm going to heat. They will. Don't create a new invoice on now. I have toe. I have to provide a description for the invoice. In this case, the description will be, um, clothes for men on woman. Okay, that is the description for these sales invoice. Now I have to provide the seller's name. In this case, the sender's name is Amazon on the Sellers address. Well, I have to specify the sellers address. In this case, the seller The seller address will be a street 25 uh, New York, for instance, on now it's up to provide the information of the customer off the customer. In this case, I have to provide the customer's name. So the customer name will be on Nicole Kidman. That is the name of the customer, and I have to provide the customer address. Okay, so in this case, the customer address is the street 24. Uh, Los Angeles. Okay. And now, if you scroll down the screen, you can see that I have to provide at least thing off items and prices. Okay, so I'm going to add one item. The first item will be a blue T shirt. On the price will be 55 350. Sorry, I'm going to add one more item on breath T shirt on the price will be 350. I'm going toe, um, one Bayer off boots on the price off these items will be Ah, 500. And now you can see at the braces the listing off items on prices. Uh, this place. Um well, as you can see, the listing above this place, the items and prices. OK, now I'm going to add one more item. I'm going toe have a blue dress on. In this case, the price will be 600. He hit the buttons of meat item. Now I'm going to add one more item. Ah, a Bayer Bayer off shoes, OK, and I'm going to set the price toe 650. I hit the buttons of meat item. Now, as you can see, I have, uh I have well on listing off items and prices on if I scroll down this screen you can see that Here I have the final price. Okay. And as you can see, the final price waas calculated automatically. Now I have to provide the terms and conditions on the terms and conditions in this case, our payment he's made Born, uh, receipt born received off the invoice open received off the invoice. Okay, that is the terms. And those are the terms and conditions. Okay, payment is made open. Received off the invoice. Now hit the button. Create a sales invoice on as you can see, a new ah window. This place that says success. The invoice was created successfully. I hit the wooden clothes on and I have to go back to the home page. I know what I want to do is to hit the blue button that says show all invoices. I know you can see here. I have a listing that this place, all the all the invoices that are available now you can see at the bottom of the listing of the new invoice appears. Okay. Now, what I want to do is to view these invoice. So I'm going to hit the yellow button that says view Invoice on now As you can see, they imposed this place on the screen. Okay, The invoice contains the seller's name and address the customer's name and address. It contains the name Bush description. A swell as the listing off items on prices. And as you can see here, I have the final price on the terms and conditions off these invoice. Okay? No, If I, uh, he they don't go back toe invoices listing. Well, as you can see, here I am again on the invoices listing. Now, what I want to do is to update these invoice. Okay? The impulse that I just created, I want to update it. So I'm going to hit the blue button that says date invoice. And now, as you can see, these, uh, these window this with Paige, this place that says update invoice. I know what I want to do is is adding one more item, so I'm going to ask the item. A smart phone. It's not phoned on. I'm going to set the price toe 1200 Now heat the good tons of meat. Item on. As you can see, the new item appears on the list in OK, now I'm going to add. One more item that's on such items is iPhone, then and I'm going to set the price toe 1200 as well. I hit. Submit item on As you can see, the iPhone, Then I eat them appears on the listing as well. Now what I want to do is to change theme the invoice description. I'm going to have a smart It's my phones on. Um, Now, as you can see, the final price waas they death automatically, Aunt. Um Well, now what? What I have to do is to hit the button that says update, invoice. And now you can see these window, this place that says a success. The information was updated successfully. Now hit the boot of close and finally have toe a press. The yellow button that says go back to invoices listing. Okay. Ah, Now what I want to do is to verify whether these in boys was updated or not. So I'm going to hit the yellow button that says Buchanan voice. And now, as you can see here, I have the new description. Okay, that says clothes for men and woman on woman on. Then it says it's my phones OK, and if I scroll down the screen, you can see that at the bottom of this least in me, I have to new items. Okay, I have a smartphone on iPhone then as well as the corresponding prices. And if you analyze thes with pace, you can see that the final price has bean updated automatically. So I'm going to hit the yellow button. And as you can see here I have on the on the invoices listing with Paige. Now I'm going to hit the Bhutan delete. Okay, I went toe the lead, these invoice. So I hit the good on the league. And as you can see, a new window, this place that says a success the Biswas removed successfully. Okay, He I I hit the boot on clothes. And now, if you if you analyze the screen, you can see that the boys waas removed from the listing. Okay, Now hit the yellow button that says go back to accomplish. And as you can see here, right up here I am again on the home, Bish. So, as you can see, thesis the application that you are going to create during this course. So as you can see the application is very thirsting. Onda. Well, as you can see, these course is very interesting as well. So see you soon on the and we'll see you soon. Bye. 2. Create a 'Hello World' web app with Nodejs and Express: welcome, guys. Toe not tow this video tutorial on react No JDS Express and mongo db in these Vitoria. Why? I'm going to show you how you can create a web application you see react in order to create a web application using react. The first step is to create an empty folder. So what I want to do now is to open the D terminal. Andi. Now, as you can see, I am in the C drive. So the first step that I have to take is to create an empty folder. This empty folder will contain my obligation, my react application. So I have to think I have to use the comment, make directory on then I have toe help to specify the name off the directory. In this case, the name of the directory is the name of off the directory will be, uh, invoice generators. Now I heat entered, and now what I have to do is 98 inside the invoice generator folder. So I have to use the comment CD invoice. Generate off. I know what you can see. I am inside the invoice generator folder Now, the next step that I have to take is to create a backlash. Jason, file the Packers Jason file is a file that contains a description off the obligation. So I have to use the common no puckish man a year you need now heat, Enter Onda. Let's see what happens. Well, as I said, these this comment no backlash manner you're in. It is going to create a puckish Jason file on the Packers. The Packers Jason file will be a stored inside the embellish generator folder. OK, guys. Now, as you can see, uh, the the Packers, the North Package manner here is asking me to provide the package name. So in this case, I'm going to use the default value. So I'm going to hit. Enter now. Now I'm going to hit Enter again on now. I have to specify the description off my application. The description will be very simple. It will be invoice generators you seen react. And now heat enters. Now I have to specify the entry point the entry point east. The file that will contain my server. Oh, are in other words, the entry point is the main fire off my application. In other words, the entry point is the file that contains the growth off my off my server. So the name of the file will be server doctor? Yes. No, he tender his enter again. Now I have to provide keywords that describe my application. In this case, the keywords that describe my obligation are, uh, in boys. Generators react. No. Yes. Express on mongo db Manco Devi. Now I hit. Enter. Now I have to specify the outdoor off this application. In this case, I'm going to specify my name, which is Raimundo. How he entered Hit Enter again. And finally I'm going to I'm going. I'm going toe to say I'm going toe type mean. Yes, this is it. And now my nose. But my Bacchus Jason Vile has already being created. Now what I have to do is tow clothes. The's terminal on I'm going toe open. Mic oath writer. OK, guys. Now, as you can see, I am inside my coat. It I'd or in this case, because the writer that I'm using is supplying next. So what I have to do now is to navigate is to open the folder that I just created. So I'm going to select the option open folder on now, what I have to do is to navigate toe my C drive. Ah, yes. I have to navigate to my seat. Rife. Andi, I'm going to select the option. Well, guys, now, as you can see, I am, um I am in the seed rife on. I'm going toe open before there that I just created. Remember? Remember that the name of the folder is Invoice Generator now is selected folder. And now I and as you can see, a new window opens. Opens on the's folder Contains the packers. Jason. Vile. Remember that the Pakistan Jason file contains a description off the application. Okay, as you can see things, Pakis, Jason, file contains the values that I specified in the council. So, uh, now what I have to do is to open the the terminal on Ah, Okay. Now what I have to do is tow. Sorry. Now, what I have to do is to open the comments prompt Andi. Now what I have to do is to navigate to the invoice generator folder like this invoice generator for generator folder. Now, as you can see, I am inside the invoice generator folder now the next step is to install some dependencies , so I'm going to install the first dependency that I need. So I'm going to use note puckish man a year in style instead of, uh, safe double dash safe on. Then I'm going to specify the name off the dependency that I want to install inside the project. In this case, I'm going to use the dependency called Express now hit. Enter and let's see what happens. OK, guys, Now, as you can see, the Dependency Express has already being installed inside my project. Now what I have to do is tow clothes the's terminal on. If I opened the ghost writer Andi at you can see at the bottom off this file the Resa section that says dependencies On in the section dependencies, the dependency express appears Onda, As you can see now I am using the diversion four points, 17.1. Well, this means that the express dependency is already inside my project. Now, where I have to do is to create the main, the main, the main file. Remember that inside this packers Jason file, I have a property main on the property main contains the value server dot Yes. So now what I have to do is to create the file server Doctor. Yes. So I'm going toe select the option you file, and I'm going to name this file as server Doug Server Doctor. Yes. No heat. Enter on. Uh, the first step that I have to take is toe. I declare my dependencies. So I'm going toe. Create a comment that says dependencies. Andi, in order to create toe include a dependency. I have to create a constant called express Andi. Its value will be said to require express. Now what I have to do is to create, to declare another constant. The constant will be up on its value will be said toe the Function Express. Now, where I have to do is to start creating my my first road. So I'm going to add a comment that says roads. Andi, In order to create my first road, I'm going toe use Theus statement up that get and this is very important. The worth Get east. The http meddled that I'm going to use to establish a connection between the Web server on the Web browser again, this is very important. The world get is the http method that I'm going to use to establish a connection between the Web server on the Web browser. Now, I have to specify the road. In this case, the road will be a slash. Hello, I Now I have to specify the Commander. This candor or these function will contain two parameters. The first parameter East request on the second parameter is response. Um, now where the where the what I have to do what I have toe. What I want to do now is to send a response to the Web browser in order to send a response to the Web browser. I'm going to use the the parameter response, and I'm going to use the meto sent on the perimeter that I have to specify. Here is the text that will be displayed inside the Web browser again. The perimeter that that I'm going to specify here is the east. The text that I'm going to send So the Web browser. So, in this case, the de text that I want to send to the Web browser, uh, says hello, world. Hello, world. Okay, now what I have to do is to conceal your report so I'm going to at a comment. That's a sport on. In order to configure report, I have toe use the statement up the listen. And now I have to specify a port number and risk in this case Report number east 3000 on now, I'm going to specify the callback function on this callback function will run if everything is working. Ah, If everything is working well, thes callback function will be run on this callback finish in will. Look, a moustache toe console on the message will be listening at local coast 3000. Now, this is my very first with obligation using No, I guess. And express. Now what I have to do is tow test this application to verify whether this application is working or not. So in order to do it, I have to open my Web browser on I'm going toe mean local post uh 4 3000 His last Hello on . If I heat enter, let's see what happens. Well, as you can see, nothing happens on the reason why nothing happens. He's because I have toe start my server. So the first step that I have to take he's to start my Web server. He know that was started. My Web server. I'm going toe open my my console. I'm going to use the comment. No server, don't you? Yes. Now he's entered. Andi thinks comment starts my Web server. As you can see, the massage listening at local cost 3000. This place, which means the server is working now I have toe refresh these webpage on. As you can see, the hello world massage This place, which means my obligation is working. So, um, this is it for these lissome. Now, I've just created the first with obligation using, you know, Julius and Express. 3. Configure an static web server with Nodejs and Express: welcome guys to another lesson off. These were built Victoria in this. Listen, I'm going to create an ecstatic Web server. So in order to create an ecstatic Web server, the first step that I have to take is to create a comment that says Static Web Server. It's not equipped server. Now what I have to do, what I have to do is tow use on another dependency. So I'm going to declare another constant. The Constand fat on its value will be set toe require, but and now we have to do. Is tow is to use this statement after the use, and now I have to use the Meadows Express that ecstatic. These metals will be used toe to create the ecstatic Web server. Now what I have toe due East toe. I specify a parameter for these metals. On this perimeter will be the bat to the to the directory that contains the aesthetic files again. The perimeter that I'm going to specify here is the bat to the directory that contains the aesthetic files. In order to specify the bat toe the directory that contains Theis static files I have type mean, but the join and then your name. It's important to say that your name is a constant that that contains the path to the to the root directory. Again, their name contains the bad toe, the root directory on. Now I have to a specify the name off the off the folder that contains the aesthetic files. In this case, the name of the father that contains the static files is the folder dissed. Now I have to create before their deceased on a day you can see the father has already being creative. Now, inside before the least I'm going to create a new file on the name of this file will be this thing. Surber, Doc H demon. I know what I have to do is to create a random HTML with beige. So the title of these with Paige will be this team with server on. Ah, I'm going toe at Ah, Heather. That says, ah Kello from Web server. Okay, now, as you can see these these with page right here. Uh, he's is saved inside the least. A subdirectory. Okay, this with patient is placed inside the least subdirectory. Okay, Now what I want to do is to fist. I want to I want to test these Web server so I have to go back to the council on I'm going to run. The government knows Server dog Yes. Now I heat Enter Onda. Let's see what happens. Well, guys, now, as you can see a moustache, this place on the console on the message says, listening at local host 3000 which means my application is working on. Now I have to open up my Web browser and I'm going toe. I want to try the I wanted toe best the Web server. So I'm going toe use. I'm going to say a local coast. Ah, local Khowst 3000 is lash on. Now I have to use the name off the HTML with Page that I want to see. So in this case, I want I want to see the with Paige. Ah, this thing testing server dot html. So I'm going to take mean testing server dot html Now I heat center on. Let's see what happens now what? You can see the HTML with Peixe, this place on the Web browser, which means a my my, uh, my static Web server. He's already already working. So I have to go back to my HTML with Bache. I'm going toe. I'm going to fix I'm going toe improve my webpage like this. And now I'm going to refresh these with Bache on because it as you can see the HTML with Paige this place on the browser, which means that my web server is already working. 4. Creating the routes of the REST API: Okay, guys, welcome back to another lesson of these video tutorials in this. Listen, I'm going to continue working on these web application. So what I have to do now is I have to create arrest a B I. So in order to create arrest, a p I, the first step that I have to take is to configure or to sit or to set up the roads for the rest FBI. So I'm going to delete all this gold right here on. Instead, I'm going to ask this comment wrist a p I now a what I have to do east toe. Asai said, I want to I want to configure the roads for my rest FBI. So in order to configure the first road, I'm going to use thesis statement at the use. And now I helped to specify the bat on the bat or the road will be a slash ap I slash create invoice. Now the next parameter specifies the the file that contains the JavaScript growth. In other words, be second parameter specifies the file that contains the JavaScript code that will be run when these road is used. Okay, eso I'm going toe typing some text to give you a better idea. Ah, Filed. That contains the ghost that is run. Ah, when the bat he's used. Okay, probably Probably. This is too much. Too much, too much text. But basically the second parameter contains the file. The the the second parameter east. The file that contains the cold That that is Ron when the path is used. Okay, So, uh, I'm going toe in order to specify the file that contains the JavaScript gold that will be run when thesis pat is just, uh Well, I have to space. I have to take being require on. Then I come to a specify dopes is lash dot it slash represents and the current directory on . Then I have to specify a new father that is called roads on. Then inside before the roads, I'm going toe, specify a new file gold and create the year. Yes. So off course as you guys. You know, as you can see, I don't have before the roads on. I don't have the file create. Create those. Yes. So I have toe have to create the folder roads. So I select the option new folder on going toe main this folder Ass roads. Okay, now, as you can see, I've us created the folder Roads on inside before the roads roads. I'm going to create a new file, so I select the option new file on the name of this file will be Create dog. Yes. No, this file. Um, it's going well. And now I am inside the file. Create doctor. Yes. So the first step that I have to take is to create a comment that says dependencies. Now I'm going to declare a constant called ah Express On its value will be said toe require express. Now I'm going to declare another constant cold router on its value will be set toe require its value will be said toe express that rule dish. Now what I have to do is to export the the contents off these file. So I'm going Toe Avenue comment that says exports, exporting the contents off this file. So the next step is to export the contents off these file so that the contents off this file are high level. Took out the application. In other words, I want to make the content off this file public. So in order to make the contents off this fire public. I have typing. Um, would you dot exports equals Rubisch. Now what I want to do is to configure a road. So I'm going to add a comment that says roads on my first road will be created with this statement. Rooter don't get remember that the world get river represents the http method that will be used to establish a connection between the Web server on the web browsers. Now I'm going to use the the but is slash Remember that the bat is slash, Um is like the root path or the the pat for the home page, for instance, Andi. Now I'm I have toe create a route hander on this route. Hander will contain two parameters. Request on response. And now what I want to do is to send our response to the browser. So I'm going to use the metal sent on the text that I want to display to the browser east. He's ah, Heather one that says hello from root there. Create Doctor. Yes. So now what I want to do is tow to test these theories. This application. So I'm going. I have to go back to the console on now. What I have to do is to a stop my Web server. In order to stop my Web server, I have to press the keys controversy. So I present keys Contras E on. Now I have to restart a server. And as you can see on you moustache this place that says listening at local host 3000 Now I have toe I have to go back to the web browser on I'm going to use the road. Local Khowst 3000 slash a p. I is lashed, Create invoice. I know I heat entered and as you can see and you may sash this place to the browser on the message says hello from router router, create dot Js which means my my router is working. So now I have to repeat this process and three more times, So I'm going to copy this a statement and I'm going to paste it. Ah, three more times like this. Now what I have to do is tow change the the road. So these wrote will say, um abia slash ap I is lash. Ah, read Invoice on the file will be read the year. Yes. Now I have toe change. These these router, um the but will be update invoice on the file will be update dodgy. Yes. Now I'm going toe change. This last wrote on the new value will be, uh, believed invoice had I'm going to name the file us the lead the league dot Js. Okay, now what I have to do is to create three more files inside the roads folder. So Ah, where it happened where we went to the now east to save. Okay, what I want to do now is to save this file. No, I'm going to create any file. Andi name of these file will be read off. Yes. And now I'm going to copy the growth of these routers on going to baste it like this. Andi on now, what I want when I want to do is to change the text a little bit. The text will be hello from router. Read the Yes. Now. I'm going to create a new file inside inside the I'm going to create a new file inside the roads folder on this file. Uh, the name of this file will be OK. Yes. Now I'm going toe based. The same goes, but I'm going to improve. I'm going to change the V text a little bit. The text will be hello from Rooter. Hello from Router They doctor? Yes. Now he said that They say the changes on now I'm going to create a new file inside the Roads folder. So I select the option new file on I'm going toe. I'm going to name this file as the leader of the year. Yes. Now I'm going to paste the same growth, but I'm going to prove the text a little bit now. The text says hello from route the lead dog. Yes. Okay, so I have the village router. Viewed date router there. Read routers on the create rulers. Okay, so and now I have to go back to the console on again. I have to stop the server. So in order to stop the server, I have to press the keys control. See? So presidencies controversy, controversy. Okay, now I have I've just stop my server on. I have to restart the server now, as you can see, a new message this place that says listening at local Khowst 3000. Now I have to go back to To my today, To the web, to the Web server on. I'm going to use a new road that says Read, Read invoice. Local host 3000 slash AP I slash reading bores I hit. Enter on that. You can see the massage that this place to the rouser says hello from Rooter Rib Dodger. Yes. Now I'm going to change the text a little bit. A local host 3000 is lashed A p I slash Ah. Date invoice now hit. Enter on that you can see. And you, Miss Ash this place to the browser that says hello from routers they don't You? Yes. Now what I want to do is to try out a new one more road that says a local host 3000 slash a b I slash the lead invoice now hit. Enter. And as you can see, I did. You can see on you, Miss Ash, this place to the browser that says hello from Rooter. Delete Dodger? Yes. Which means my wrote my routers are already confused on uh okay. I think this is it for this lesson. This is the first step that you have to think in order to create arrest a B I 5. Set up a database with MongoDB Atlas: Okay, You guys, welcome back to another lesson of these video tutorial in peace built Pretoria. I'm going to show you it is Listen, Sorry. In this lesson, I'm going toe to show you how you can configure or set up mongo db so that we can create a database. Andi, remember that We need a database so that we can store our information inside the database. So in this case, I'm going to use mongo db toe, create my race on. As you can see, I am. I have to visit the mongo db. A website. Okay, guys. Well, now, as you can see, I am inside the mongo db website on the first step that I have to take is toe is to logging into mongo db. So, um well, it's important. Oh, to say that a mongo DB offers a free version. So in this case, I'm going to use the free version off mongo db to create a database and store my information. Okay, guys. Well, now, as you can see, this is the logging with Paige. Andi. Now what I have to do is to provide my user name and my password so that I can looking into mongo db. So I'm going to escape this part off the process. But basically, what you need to do is to create a free mongo DB account on. Then after you create a free account, you can looking into mongo DB. OK, guys. Now, as you can see, a GM inside mongo db on, um, the first step. Well, I know what I What I want to do is to configure, um is to configure a new that arrays. So the first step to configure a new database from scratch, he's to head over to the Cooper Cooper left corner on on on the upper left corner the res. A drop down menu that says a context. Now, in the drop down menu, you have to select the option new project. Okay, guys. And now this is the webpage that this place on that you can see. I have to provide for my project. In this case, the name for my project will be, uh, in boys in a rate door. That race in boys generator that the race is the name off my project. Now, the next step that I have to take east to press the Bhutan that says next. Not now. I'm going to press the brutal. Next on, let's see what happens. Okay, guys, after pressing, they will don't next. This is the webpage that this place. So now what I have to do is to set the permissions for my database. So in this case, I'm going to escape this part off the process. I don't want to sit. So to set permissions, I don't need toe perform these this part of the process. So I'm going to escape these thesis and section. So the next step that I have to take is to press the button, create project president. You don't create project on. Let's see what happens. Okay, guys. Well, after pressing the boot, don't create project. This is the webpage that this place on DNA now, the reason option that says create booster Andi. Um, well, I have toe. I have to choose my cloud providers. So I'm going toe. I'm going to press the button, build a rooster. So, President, don't build a rooster on. Let's see what happens. As you can see, these are the options that I have available. So there are basically there are three options. Onda thea option that I'm going to use is the free option. Okay. Remember that mongo db offers a free version on the free version of off mongo. DB can be used for testing purposes for for testing. So in this case, I'm going to use the free version of off mongo db. So I'm going to press the Bhutan and that is found below they worth free. Okay, so I'm going to use the free the free service for the free version. So I'm going to president. Don't create a rooster. Okay, guys, after after pressing the button, this is the the the Web based that this place now, as you can see, I have to select my cloud providers on. I have three options. Amazon Web services. Google Cloud on a story. So I'm going to select the option on Google clothes. Andi, after selecting after choosing the option Google Cloud on now I have to scroll down on the Resa section that says a You were Andi under Al Uwe the Reese. A text that says free tier available. So what I want to you. What I want to do is to use the free dear or the free tire. So I'm going to select the option you are that offers the free version for the free service . Andi. Then I'm going toe. I'm going toe to verify that the the free service is selected. So as you can see here I am using the free service that offers 512 mega writes off the store ish Andi. Okay, I'm using the free service here as well. On, uh, before you scroll down, you can see that I have to specify the name off my grocer. So in this case, the name off my cluster will be in boys generators, invoice, generate or up. That will be the name off my cluster on. After setting up all those options, I can I've just set up my cluster. So now what I have to do is to press the button that says create Brewster's and remember that the Bhutan create cluster is found at the bottom off the web page. So President, don't create Brewster the guys after seeing the boot don't get booster. This is the webpage that this player browser on. As you can see, my cluster is being aided. But this process takes a while on generally, this process takes several miss. So I'm going toe. I'm going to space part of the process because this place a while OK, guys now, as you can see, the the cluster has already being created. So now what I have to do is tow. Press the button that says Collections that you can see there are three. Bhutan's one is connect, the other is metrics on the last one is collections. So please President collections eso Well, I'm going to President Ahn collections on Let's see what happens. Okay, guys, after pressing the Bhutan collections, this is the webpage that this place on at the bottom of the page there are two Putin's one Bhutan says load a sample that that that is it on the other who don't says at my own data. So what I want to do now is to press the button that says my own that. So I'm going to president. Don't ask my own daughter on. Let's see what happens. This is the the window that this place, So I have to provide the other ways name. In this case, the database name will be in boys store ish on, uh, the collection name will be, ah, invoices in invoices. Ah. Okay, guys. Well, now the name off the off the collection. Or in other words, the collection name will be invoices in voices. Okay, this is the name off the collection voices on now I heat, they would don't create. And now let's see what happens. Well, guys, as you can see, the boys is to rush That always has already being creative on inside me that always we have a collection or a table whose name is invoices. So this is it for this lesson. Now you know how to set up on new a new that the race on help to place a collection inside the database. Remember that a collection is similar to a table. Ok, well, I Well, this is it for this lesson. 6. Connection to MongoDB Atlas: Okay, guys, welcome back to another lesson off these video tutorials in peace. Listen, I'm going to make a connection to the database. So the first step to make a connection to the database is toe. Well, I need to install a new dependency. So, uh, I'm going to open the comments prompt on. I'm going to stop my Web server by pressing the keys control. See? So I have to press the keys control. See on. As you can see, the server has already stopped on. Now, what I have to do is to install a new dependency. So I'm going to use the comments. No package manner, your install instead. Double dash. Ah, save. And now I'm going to use the dependency Mongoose. No, I hit. Enter on. Let's see what happens. OK, guys. Now, as you can see, the mongoose dependency has already being installed inside my project. Now, if I closed the the command prompt on if I opened the packers Jason file, you can see that at the bottom of the packers. Jason file. There is a section called Dependencies on the dependency. Mongoose appears inside these sections. Oh, right now I'm using the version 5.7 point 12. Well, now what I have to do is to go back to my Web server. So the server dot Js file on. I'm going toe to declare a constant called mangoes on. I'm going to say this. I'm going to say this cause this constant toe the value require require mangoes. Now, where I have to do is to make a connection. So they do that a race. So in order to make a connection to that of race, I have to head over to the section today. I have to head over to the option that says clusters that is found on the left side, off the browser on the left side, off the browser. The recent option that says clusters. So I'm going to click the option boosters on. Let's see what happens. Okay, guys, after selecting after after pressing the option boosters at this page that this place now Sal Bhutan that's connect. Okay, there are tribal dunked. The other one is metrics. And finally, with captive Bhutan collections. So what I want to do now he's depressed. They don't connect. So President on Let's see what happens. Okay, now what you can see. Uh, I have to I have to wear so repressive, but don't connect again. And as you can see, this is the window that that this place so and now I have to configure your toe, have to configure, um, the I B address that I'm going to use to make a connection toe these that always. So I'm going to spread the button that says, um, at a different I p address. Okay. Thereafter Wooten's one Bhutan says at your current I P address on the other one says at a different I p address. So I'm going to press the button that says at a different I p address on I'm going toe asked a random i p address. So I'm going to type in zero doc zero 0.0 Don't zero now. As you can see, I have Here are random AP address ah, that contains for foresee Rose. Andi, I'm going toe. Uh, I'm going to press the button at i p address. Andi. Now what I have to do is to configure user name as well as a password to make a connection to the database. In this case, the user name will be route. The user name will be said to root, and the password will be said toe. Ah, the password will be said toe. Hello? Mm. Fellow world. Okay, I'm going to set the passwords toe. Hello, world. Okay, now what you can see, I've just created a user name as well as a password on the password is hello world. And now I have to preserve it on that. Says, create mongo db user. Now, I press it wouldn't create mongo db user on basis it. And now I have to press they would don't choose a connection method. OK, at the bottom of this window, the reset button that says choose our connection. Metals. I present button, choose a connection. Metals on. There are three options of high level. So what I want to do now is to select the second option that says, connect your application. Okay. I'm going to select the second option that says connected your application on a So you can see at the bottom of this window there is a connection string on pieces. The connection is drink that I'm going to use to connect toe, make a connection to the batteries. So I'm going to President Ahn Copy. And now I have toe have to go back today to the Web server on. Now what I want to do is to have a comment that says connection mongo connection toe mongo db. Okay, and now I'm going toe Use the method mongoose dot Connect on. I'm going toe based the connection string like this. So I'm going to split this connection string, uh, so that you can I'm going to split this. I'm going to split these. This connection is drink like piece. Okay, I'm going to split these connections. Strange. Okay, now you can see this is the connection. Strange. But now I have to replace the password placeholders. So we have here a placeholder that says password on. Instead, I'm going toe type in Hello world, which is the the password that that I thought that I thought created before. Now its upto um, I have to specify the they have to close this window. And now I have to specify the name off the off the database that I want to use for this application. So, as you can see, I've just press the button collections on a tieu can see we have the other ways in boys store ish. Okay, this is the name off the data race that we are going to use. So I'm going toe replace the the best wheat invoice, Mr Rush. OK, so I have here the the name of the name of the database that I'm going to use on on now. What I have to do is to Okay, now, what I have to do is tow to more methods. So I'm going toe tomato mongrels. Mangoes dot on on these methods is going to be used if I never happens. Okay. If the if the connection is not working, these methods will be used on. As you can see, this medal contains a second parameter that is a callback function on if on if something is not working, then on a moustache will be locked to the council on the massage will say ever and in space and then the error message. But I'm going to configure another method that will be used in case that everything is working. So if everything is working, these methods will be used on this method. Contains a callback function on this callback function Well, look, a moustache toe the console that says the connection to Mongo Levy Atlas is working. Okay, so, uh, thesis it now, what I have to do is to go back to the council and, um, I have to run my application, so I'm going to use the comment note. Server top genius on. Let's see what happens. OK, guys. Now, as you can see on every word this place on the on the console on I have to fix this error. So I have to go back to my application on instead off using the statement Mom goes dark on , I have to use the statement mangoes dot connection dot connection dot on. Sorry on. I have to use the statement. Mangoes dot connection dot Once. OK, I have just made some improvements to my application, and now I have to go back to the console on I have to run the government. No server dot Js on. Let's see what happens. Okay, guys. And well, now you can see a new error this place to the to the console. So in order to fix this, ever I have toe have to goto my them to the metal mangoes dot Connect on I'm going toe atthe on object. Asked The second parameter on this object is going toe have toe two properties. The first property will be a use New u r l Parsons Like this on the second property will be , uh, use unify topology. OK, so I'm going to copy the second property, and I'm going to paste it like this. Okay, so now you can see this is the the new growth that you have toe toe asked toe the method. Mangoes don't connect. Okay, on. Uh Okay. See, I'm going to say that these two true on Yes, I think this is it. No, Sorry. Okay, I think this is it. Now if I have to go back to the council on, I have to stop the server by pressing the geese controversy. So, President, he's control sing. And now let's start the server and let's see what happens. Okay, guys, A. So you can see the application is running already on, as you can see, to miss Ash to a new message, this place to the council and the message says listening at local Khowst 3000 on the second message says the connection to mongo DB. At last, he's working, which means that my connection to the database is already working. So, um okay, this is it for this lesson. Now you know how to make a connection to the Mongol Levy Atlas batteries? 7. Creating a model with Mongoose: Okay, guys, welcome back to another lesson off these view tutorial in these. Listen, I'm going to create what is known Assam modern. So a model basically is a description off the information that will be a stored inside the database. So in order to create a model as well as an s kema, uh, I'm going to create any further on the name of the Father East models. Now, inside these folder, I'm going to create a new file on the name of this file is a invoice. Does your Yes. Now he enter. I know the first step is to, uh, to go to the clear toe, the clear a constant called mangoes. And I'm going to say this gun this constant toe require mongrels. Okay, Now what I have to do is, as I said, I have to create a model as well as on the schema on both the model as well as on as well as the schema enabled. Enabled the well the model as well as he schema are used to describe to describe the information that he's a store inside the mongo db. That always. Okay, so in this case, I'm going toe create on a schema. So I'm going to add a comment that says mangoes a schemer. And this is Schema is going to describe the information that will be a stored inside the batteries. So the name of this constant will be custom is schema that its value will be set to new Mongu stopped a schemer. Now I have to provide a parameter that is an object on this object will contain several properties. Each off those properties is a description off the information that will be safe inside the database. So, for instance, the first the first property is sitting. And, uh, these, uh, these property seller name. He's off the type of strange Andi is required. So I'm going toe at the property required on I'm going to set this property to True. Now I'm going toe create another property called Sylar Address on this property. Uh, this property is off the type fixed. Sorry over the type of strength, hon. It's a property that is required so the property required will be set to true. Now I'm going to ask two more properties and custom customer a name on the's properties off the type A strange Andi is a property that is required. So I'm going to set required he quite the drew on, um, going to add another property costumer address on these property will be a stored inside that the race on is of the type of strange and is required as well. So I'm going to set the property re wife equals true. Now, um, we Now I'm going to add another property. A property called date on this property. Ease off the type. Date on bond is the fault. Value will be said toe date that. Ah. So it's the falls. The value will be date thought now and now, Uh, now I'm going to ask another property. It is property with the items on the's property will contain Honore on Visa. Ray Will, uh, these are ray. Okay. Thes air ray will contain a set off objects on its each off. Those objects will contain on two properties. The first property will be description on this property will be off the time. A strange on, uh, the property will be required, so I'm going to say it requires equals to true on again. Well, at this object will contain a price property as well. On this price, property will be of the DYP number on, uh, this property will be required. So I'm going to set the required property he could do through. Okay, Now what I have to do is tow Have Ah, he's 12 1 more property. No, I need to ask one property called Find a Bryce. Okay. Yes. Final price on these property easily. There will be peace of the type number as well. Andi. He's a property that is required. So I'm going to set the property. Revive. He quite true. Ah, I'm going to work. Let me see. I'm going toe. Ah, One more property. Now I'm going to add another property called Turns on this property will be off the type text off the type of string. Sorry on this property will be required. So I'm going to set Required he quite true on. Um, Finally, I'm going to ask a property called invoice description on, uh, these property will be off. The type is of the type of strange story. This all the time off. The type of strange on this property is required, so I'm going to set required equals. True as well on. But you can see this schema contains a description off the information that will be a Stort or safe inside the batteries. Okay, basically, this is only a description off the information. Now, what I have to do is to export export the model as well as this a schemer. So I'm going toe export These. So in order to export these cold, I'm going to take me. No, your exports equals mongoose dot a model. And now I have to specify a first parameter. Uh, the first parameter contains the name off the collection that will be used to a store. The information. So I want you to pay attention to these because this is very important. If you don't pay attention, you have to pay attention to these. Otherwise, your application is going to crash. OK, so pay attention to this, please. Now, if if I analyzed the day Mongo TV that the race, you can see that I have a lot of ways called in boys Store ish inside. The ambush invoice is to rush that always. I have a collection on the collection. The collection's name is invoices. OK, invoices. And you can see that the name of the collection is invoices. Okay, with, um with a leather s. So the name of the collection is invoices. Now, if I go back to my obligation, the parameter here that I have to specify East in boys Onley Invoice. So this is the senior version off the world invoices. So again, invoice is the singular version off the name invoices. So here I am. I am in Mangala Devi Atlas. You can see that I that here are you specify invoices with the letter s so I'm using the plural. The plural version off. Invoices off invoice. Sorry. So here I am using the plural, the plural version. But if I go back to my coath, you can see that here I am using in boys. Only on em, boys, is the singular Persian off the collection's name. Okay, without the leather s Okay, this is very important. You have to type in invoice without the leather s here. I have invoices with leather is on board here. I have invoice without the leather s the singular version off the collection's name. Okay, Now I have to specify my my my schema on. Remember that my schema. He saved inside the Constand custom schema. So I'm going to take mean custom is a demon. Okay? And this is it. This is it for this lesson. Now you know how to create a modern unless as well as any schema that this grave, the information that will be safe inside a mongo db that the base 8. Body Parser: welcome guys to another lesson off these view tutorial in these. Listen, I'm going toe in style. Another dependency that I need to use inside these application visa pendency is known a visa. Pendency is body Parsons. Embody Person is a dependency that enables our application toe to handle toe handle the input that comes from the web browser. Okay, So in order to install these dependency volley part, sir, that enables our application toe handle the input that comes from the with from the web browser. Where I want to do now is to open up the console. And now I have toe stop the server. So I have to press the keys called Rosie. And as you can see, the server has stopped on Now. Now I have to type in no package, man. A year in style, double dash safe, and then body. Now I heat, enter. Andi, um, I'm going to stop. I'm going to escape this part off the process because, um, this this the installation process takes a while. So I'm going to escape this part of the process. Well, guys. And now, as you can see, the installation process is complete. So now I have to close the console on. If I go back to my application, you can see that inside the Packers. Jason file at the bottom of the Buckeyes. Jason vile. The Resa section that says dependencies on inside these sections or inside his object, there is a property called Bully Partners, which means that thes dependency is already installed inside my project will. Now, I have to go to the server dot Js file on. I'm going toe declare a constant called body Parsons on. I'm going to say this constant equal toe require for the now what I have to do, of course, is toe config your body part, sir. So, in order to configure body parts, sir, I'm going to add and you comment that says body Parsons on in order to configurable the part, Sir, I'm going to use the statement up of juice and then body Parsons. Don't you are l encoded and then I'm going to pass on argument in this case, these the argument is on object, and it has the property extended. Extend death on this property is said falls. Now I'm going toe have a new a statement that says I have to use on. I'm going toe typing body parts, sir. Thought gazing. So remember that thes dependency body purser enables our our application so that the application can handle the input that comes from the with browser. So body purser ah takes the input that comes from the web browser on the stores. The input sa Jason object. Okay, so you know, in other words, about the part, sir takes the include that comes from the West Web server. Sorry from the Web browser. But the parcel takes the input that comes from the Web browser and formats or stores the boot as, ah Jason object. Okay, as as an object with many properties. So in a in A In other words, body parts there enables the application do toe handle the input that comes from the Web browser and then stores the information that comes from the Web browser on Saves the information as I Jason object that has properties embodies Well, this is it for these. Listen on. In the next lesson, I will continue working on the in the next lesson. I will continue working on this application 9. Using a REST Client: Okay, guys, welcome back to another. Listen off. These video tutorial in these lesson I'm going toe. I'm going to install a program that I need to use in order to test the rest A b I. So this program is called a rest client. Andi, arrest client basically allows me to send on http request to the Web browser, and then I can get the response from the Web browser s so that I can taste my wrist A b I. So there are many rest clients at my level, but the rest client that I used that I use is a rest client that is called at bands. Rest quiet. So what you can see on the screen there is a link that says advanced raced client on this program. As I said, I'm going to use this program Toe based my rest A b I OK, so I'm going toe click the link that says advanced rest client Andi. After after clicking billing, you can see that I am inside the home. Bish. So the competition well, as you can see contains Abu Don't that says down loathed on this Put on that says down Loth he's used to get the installer off this program, so the installation process is very straightforward. You just have to press the button that says, download on. You will get the installer off these program. So I'm going to press the button down love on, uh, as you can see on the bottom, left on the bottom, left corner off my web browser. Uh, the installer is being don't know that, but the's process takes a while off course. This process takes several minutes, so I'm going to skip this part off the process. OK, guys. Now, as you can see, I have already don't know that the installer off the program. So what I want to do now is simply open. The downloaders are sorry. And what I want to go now he's is to open the installer off this program. So I'm going to open the installer off this program on. As you can see, the installer is very fast. The installation process. Um, it starts automatically. Andi. He's very vast. It only takes, uh, a few minutes to install the program on my computer. So, um okay, I'm going to wait for a while to see what happens but the installation process is very fast . Okay, guys will now, as you can see, the program he's opened automatically and that you can see. Uh, this program east arrest client on this program allows me allows me to send on http. Request to the web servers. And as you can see, I can send Get a get request. I can send a post request. I can send a put request at Elite Request Apache request. Andi, I can configure the headers off the request. I can configure the body off the request. Andi will. As I said, this program is used four testing rest 80 ice. So this is it, guys, for this lesson, Andi. Well, basically, you have tow genius cut toe, install the program on your computer. 10. REST API : Creating an invoice: Okay, guys, welcome back to another lesson off these video tutorial. It is less on what I want to do East toe to configure my rest ap I so that it can save on in boys inside the other ways. So in order to configure these rest FBI so that it can safe a new envoys inside the other ways, what I have to do is tow fell over to the file, create the jail. Yes, on as you can see, I am inside the defile. Create Northgate. Recreate the J. Yes. Now what I have to do is to import the model that I have created in produce in in a previous lesson. So I have to declare a constant cold invoice model on I have to set these. I want to say this court, these constant, uh, equals toe require double dot slash. And then, as as as we know it as you know, it uh, the mother's directory contains the model for my daughter ways. So inside the models directory, I'm going toe Well, I have to specify the bad toe the envoys dot Js file Remember that the invoice dot judges Js file. He's the file that contains the description off off the information that I went to a start inside the database. So I have to specify the bad toe. The file invoice dog? Yes. On this is the fact the but toe the file invoice stop Julius, which contains the model off the batteries. Okay, after I have saved the model, when I want to do is tow declare. Another constant called input on its value will be said toe will be said toe. Its value will be said toe request that, uh, body on. It's important to say that the object request that body contains the information that is sent from the web browser again, this is very important. The object request that body contains the information that he's sent from the web browser. Okay, now what I have to do is to create to create a new a new document. So, um, I'm going to be clear. And another constant cold new document. Andi, in order to create a new document, I have to type being new, then invoice model on, uh, and now I have to pass a new perimeter. Okay, now, inside thes metals. Inside the invoice model metals. I have to pass a parameter on this perimeter is an object on this object contains automation that I want to a store inside the batteries. So, for instance, and according to my model, inside my the other ways, I have a property seller name. So, uh, I'm going to type in the property seller name on its value will be said toe input dot cellar name. Now, according to the to the model, I have a property center address. So I'm going to add the property seller address, and it's very will be said toe input thought sylar address. Now, according to my mother, I have a two more properties, customer name and customer address. So I have to specify the property. Cousteau, her name at its value will be said toe input. Sorry. Toe in boot dot Customer name. Now I have to add another property customer address on its value will be set toe import dot customer address. Now, according toe the model, uh, I have to specify the date, but if you analyze these model, you can see that the date has a default value. So in other words, the date is not required, so I can escape the date. So I'm going toe head over to the today. I'm going to ask. And you will, According to my model I have toe at, I can I have toe the property items. So, uh, the property items will be will be set to input the items. And according to the model, I have two other property final price on. I have the property. Final price on its value will be said toe input input that final brace. Now, according to the model, I have to ask the property terms. So I specify the property terms on its value will be said toe input Thought turns. Now, according to the model, I have two other property in boys description as I have I'm going toe. Specify the property invoice. This description on the value of this property will be said toe input that in boys description. So, as you can see, I've just configured the information that I want to a store inside the arteries. Now what I have to do where it wants to illusory east toe, save this information inside the database. So I'm going to add a comment that says saving, saving the information inside the batteries on in order to save this information inside the that the race, I have to use the constant new document on. Then I have to use the metal's safe on. Uh, Okay, now these these thes metal's safe requires a callback function. And this callback for mission has two parameters. The first parameter east Aurora and the second parameter e stock. In this case, I'm going toe. I'm going to use only the error parameter. I'm going to use the ever parameter only. So I have to I have to create Anethe. And if Block that says, if a roar, which means that if I never takes place Or in other words, if something if something goes wrong uh, these this block here, he's going to be run. Okay, So I'm going to add a comment that says, Ah, something went wrong. Something went brown. So this is the growth that will be run if there is a problem when the information is being safe inside the batteries. So if there is a problem, a message will be looked to the council. How the message will say a roar space. Andi, I'm going toe as the error message Okay, But, uh, if the if everything works, if if everything works or in other words, if everything succeeds, then the else block will be used on. I'm going to add a comment that says everything. Everything is okay. Everything is okay. So if everything is okay, if everything is working, then I want toe look, a message to the console that says the information. Wes Safed. Okay, now, off course, I want to send a response to the so the Web browser. So in order to send our response to the Web browser, I have to use the the object response. And then that. Is that those? Okay, so if there is a problem, I have to send on its status number toe the Web browser. And if if there is a problem Ah, the status number that that will be sent back to the Web browser is the number five conference. Andi, if there is a problem, I'm going to send a response to the Web browser On the response to the Web browser will be a Jason object that contains the message. Property on the value of this property will be the information. Ah, what the value of these off the message property will be problems when saving the information. OK, this is the response that will be sent back to the web browser if something is not working . But if everything works fine, then I want to send on Is that this number Toe the Web server to the Web browser on the status number will be 200 on now. I want to send an object to the web browser on this object Will contain the property message on the massage. Will will be the invoice. Glass created soup, sis fully. Okay, then boys was created successfully on um Okay, I'm going to prove the message that is sent to the council. The missile will be, uh, the invoice. WAAS created soup cess fully. Okay, now, three application has the ability to a store information inside the batteries. But before I finish, I have toe modify the http medals. Okay, so in this case, I have, uh, router don't get But if I want to save information inside the that the race, I have to use the http metals post post. Okay, so I have to use the post metals, so I'm going toe the leading this and I'm going to bean router the Post. Okay, remember that when saving information inside the database, I have to use the boast medals. Okay, that's very important. Okay, I guess this is it. And so this is it for this lesson. Now, the application is is ableto to a story information inside the batteries. But before I finish, I have to remove these line off. Both right here. I removed his line of go off growth. Andi. Now this is it. Now the application has the ability to store information inside the batteries. 11. Testing REST API : Creating an invoice: Welcome. Welcome, guys, to another lesson off these video tutorial in this. Listen, what I want to do is tow is to test the rest A b I I want to verify whether the ar