Become a web-developer by learning Node.js , Express and MongoDB | Raymundo CH | Skillshare

Playback Speed


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

Become a web-developer by learning Node.js , Express and MongoDB

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

45 Lessons (9h 15m)
    • 1. ComercialNodeTurorial 3

      4:41
    • 2. InstallNVMandNodeJS 1

      12:17
    • 3. HelloWorld 2

      14:51
    • 4. StaticServer 3

      8:50
    • 5. StaticWebpages 4

      12:00
    • 6. HandleHtmlFormsPart1 5

      13:34
    • 7. HandleHtmlFormsPart2 6

      14:33
    • 8. HandleHtmlFormsPart3 7

      5:24
    • 9. ConfigureEJS 8

      14:13
    • 10. TemplateEngines 9

      14:33
    • 11. TemplateEngines 10

      13:36
    • 12. Routers 11

      13:56
    • 13. Routers 12

      10:35
    • 14. Routers 13

      9:30
    • 15. MiddlewareIntroduction 14

      14:28
    • 16. MiddlewareRoutes 15

      10:14
    • 17. MiddlewareRouter 16

      10:12
    • 18. MiddlewareRouter 17

      6:51
    • 19. MiddlewareForm 18

      14:29
    • 20. MiddlewareFormInput 19

      13:50
    • 21. MiddlewareEmpty 20

      11:59
    • 22. Midldleware 22

      11:24
    • 23. Deploy 23

      11:37
    • 24. Deploy 24

      12:43
    • 25. MongoIntroduccion 1

      11:27
    • 26. MonmgoIntroduccion 2

      9:10
    • 27. MongoSaveInfoExercise 3

      14:15
    • 28. MongoSaveInfoExercise 4

      11:33
    • 29. MongoSaveInfoExercise 5

      13:21
    • 30. NodeSaveInformation 6

      12:39
    • 31. MongoExerciseRead 7

      14:24
    • 32. MongoReadExercise 8

      13:52
    • 33. MongoUpdate 10

      12:32
    • 34. MongoUpdate 11

      11:35
    • 35. MongoUpdate 12

      14:47
    • 36. MongDelete 13

      12:14
    • 37. MongoDelete 14

      13:51
    • 38. MongoDelete 15

      5:14
    • 39. Login 16

      12:09
    • 40. Login 17

      14:10
    • 41. Login 18

      9:25
    • 42. Login 19

      14:02
    • 43. Login 20

      12:50
    • 44. Login 21

      8:27
    • 45. Login 22

      10:30
  • --
  • 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.

102

Students

--

Projects

About This Class

This videotutorial will show you how to create web-apps using Node.js and MongoDB. There are many languages available which can be used to program web applications but Node.js is the most powerful. The reason is that Node.js enables you to create a whole web application by using a single programming language : Javascript. 

Node.js enables you to create frontend as well as backend with Javascript only, so that you don´t have to worry about learning multiple languages. Take this videotutorial and see how easy and funny it's to create web application. 

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. ComercialNodeTurorial 3: you be the tutorial on no JDS Express and Mongo TV. Welcome to the scores on No JDS Express on mongo db My name is Rondo on. I'll be your instructor. I mean, analgesia is developer for three years. Andi went on, I want to share my expert ties with you. Do you want to understand No Js Express and Mongo DB in a few hours. Do you want to understand how to create with applications with no judge is fast and easy. If your answer is yes, then this course is for you. Well, he scores contains three different sections. The first section of this course is about annulled guests and express Differ section is going to show you helping style. No judges and a computer that runs Windows create your very first with application by using node.js how to handle a static files by creating on a static Web server. But you see no Js and express differ. Section also covers how to handle HTML forms help to use template engines on how to use middleware and rotors. It's very here. Well, it's important to say that routers are the tools we have available so that you can exploit the coat off your application into several pieces on middle. Where are the tools? We have a high level so that we can split the gold off our application into several functions. The first section also covers a very important topic for any Web developer. Differ Section covers helped publish. I know Jake s web application. In other words, I'm going to show you how you can deploy No Js occasion Peace thesis A very important because you will have, um you will understand how toe make your noted guests with application. My level took out the Internet. The second section is about the mongo db on the second section covers How to create or say information into mongo db by using Nodia. Yes, How to read information from mongo db by using no jail. Yes, as well. He's the second section. Also covers have today to the information that he's a stored inside mongo DB as well as how to the lead information for a mongo db by using no judges. Victor section is about looking systems on sessions. Well, given the first section off these Victoria, I'm going to show you how to create a lot in system by you. Seen O J. Guess expressed on mongo db from scratch. It is very important for any web developer to understand how to create a locking system on in this section. In the check in the third section off these beautiful toria, I'm going to show you how to handle sessions Are sessions variables by using no jail? Yes, This is a very important topic. Help to create a living system on help. Help to handle official variables. And we know Jess three. Ideally student for these scores are with the developers without experience in no J yes, as well as Web site owners. Well, as you can see thes courses very interesting. He's very complete on. And in a few hours you will have understood all that you need to know about No. Yes, so that you can start creating your own Web applications with this technology. So if you want to understand how to create Web applications with no yes in a few hours and roll and roll in in this course on the's course is great. So see you very soon. Bank 2. InstallNVMandNodeJS 1: Welcome back. Welcome, guys. Toe these video tutorial on no genius and express well, the first step in order to understand no jail, Yes, East to in style. No JDS on your computer in order to in style know JJ's on your computer. You must, um you must. You have, uh, two alternatives. One alternative is to in styled no j. Yes. From the official website. On the other alternative is to installed no, dear. Yes, by you. See, um, a program that is called no Persian manager for Windows, my favorite metals to install. Installing no JDS on a Windows computer east to use the program. Note version manager for Windows on such program can be found in the website jakov dot com . So now you can see I am in the hope of Com website. Well, actually, this is Ah, a page will approval with page that display several results, but a so you can see very on the screen. You can see that the hope dot com website appears So the first thing that you want to that you have to do in order to get toe, get the program note version Money here for Windows is to visit the website. Ah did hope that come now what you can see. I am inside the website cheat hope dot com Now what I have to do is to go to the search box on. I'm going to make a search. The search will be in the M bash Windows N B M Dash windows. It stands for no version Manager for Windows. Now I'm going to hit. Enter on. Let's see what happens after making the search. These webpage this place on, as you can see the first. The first result, says Cory Butler is slashed no version manager for Windows or end the EM dash windows. So what I have to do now is to click this option and the M Windows on. Let's see what happens after clicking, huddling These work with Patients Place. Now if I scroll down the page, you can see that we are inside the official webpage for the program No version manager for Windows. So I will continue scrolling down the page on a zoo. Can see uh, there is a niece Taylor for this program, so there isn't a link that says Download. The latest installer from the releases So what I want to do now is to get access to the installer. So I'm going to click this link on. Let's see what happens. Well, now, as you can see, a young inside another with Paige. Now, if I scroll down there they were this with page. You can see that the recent set off links on one link says MBM dash set up the ship. So what I have to do now is to click the link that says no aggression manner years atop the steep or N b m set up without sleep. I'm going to click this link on. Let's see what happens. Well, now, as you can see at the bottom left corner off your coop, you off the computer screen. Ah, program is being downloaded this toe the computer and as you can. Well, as you can see at the bottom left corner of the screen Sit folder is being down low with to the computer on. But I want to do now is to open these seep folder. So, um, yes. I'm going to open this. I'm going toe navigate to these seep folder. Now, as you can see, uh, the CPE folder is called N B M Dash set up. So what? I want to now east to extract the files from these seat folder. So I'm going to choose the option extract extract here, Andi, in order to extract the files. Now, as you can see, the files have bean extractive to my my computer on the resulting file. He's a program that is called N B M Bash Set up or no diversion, man a year set up. So what I have to do now, East toe, um, is toe open to right. Click over these this program and I'm going to Selig The option open on. Let's see what happens. After selecting the option, you can see that the installer displace. Now what I have to do is to install the program note version manager for Windows. And I said that the agreement heat next next again hit next on. Then finally, you just get the option. They don't install Now, As you can see, no version manager for Windows is being installed in my computer. As you can see, this process is very, very fast. Now the problem is being installed in my computer on the program is pretty is very small, So this process is very fast now, Um, you can see it says completing the integration manager for Windows it up. We start now. I hit the boat on fish on. Um, now what I What I want to do is tow Close this window. I'm going to open a comments. Prompt. Now you can see em inside. The comment prompt on what I want to do now is to check where there no version manager for Windows is working on my computer. So, in orderto check whether no brushing manager is working on my computer or not, I'm going to type in no version, man, a year version, and then I'm going to hit. Enter on. Let's see what happens. But you can see a diversion off. No diversion. Manager appears on the comments. Prompt on diversion off note version. Man a year, East 1.1 point seven. This means that an old version manager is in styles. Um, on my computer. So now what I have to do is to installed no jail. Yes. So I'm going to take me no aggression, man. A year in style version diversion off. No jail Yes, that I want to install is the version 8.16 point zero on. I want the version that works in 52 beats computers, so I'm going to type being 32. I'm going to hit. Enter on Let's see what happens. As you can see, a note version manager is installing no Js. Version 8.16 point zero on the's process takes a while, so I'm going to skip this part of the process now, As you can see, another program is being downloaded on in South on such program Is and B m n p m stands for note back Cashman a year No package man a year or NPM is the program that enables you to install dependencies for no Get yes again as you can. As you can see, NPM, the program NPM is being installed on my computer. Andi npm. It stands for no puckish man. A year and no pashmina. Your easy program that enables you to install dependencies for no jail. Yes, and the stitches are very important program as well. Okay, guys will now so far s so far a note version man a year. No, no. Yes. Has bean installed on my computer. Now, in order to use on O. J. Yes, I have toe typing and typing another comment. This comment is very important because this comment enables you to to use on a specific version off no judges. So in this case, I know I want to use the version 8 2016.0 which is diversion that I've just installed. So in order to use on a specific version off No, J yes. You have to type being no person man a year use eight going 16.0 42 beats for a titty to its computers. So, uh, these comment a specifies diversion off? No JDS that I went to use So after this, after typing in this comment, I just have to hit, enter and let's see what happens. Well, now, as you can see on the screen, uh, the diversion 8.16 point zero off. No Js east enables. So now I can use no judges because no judges is already enables in my computer's. Okay, so basis it for these lesson guys. Now you know how toe how to you. Now you know how to, uh in style No Jade. Yes, but you see no version. Manager Andi, remember that knows version manager enables you to install different versions off. No, J Yes. On. Then you can choose which version to use again. This is very important. Note version. Manager enables you to install several versions off. No genius, and then you can choose which version you want to use. Okay, that is the advent Ash abusing. No aversion manner. Year that note version matter. Your enables you to install different versions of different versions off. No, J Yes. On. Then you can choose diversion that do you want to use? Well, guys, vicious it for this lesson on in the next lesson, I will I will create my first no jail yes, application. 3. HelloWorld 2: welcome guys to another lesson off these video tutorial. Now, in these listen, I will start creating my first with application. You see no j guests on express, So the first step is to I'm going to head over to the stop on. What I want to do now is to create an empty on empty directory or empty folder. I'm going to name this folder US first, uh, Now I heat enter. And as you can see, I've just creative on empty folder. Now, what I have to do is to open the comment prompt. I have to navigate to these to these directory. So I have to like being changed. I have to type in change, directory the stump, then heat enters. Now I have bean change directory. First up, hit. Enter. Now, as you can see, I am inside through the directory. The directory that I just creative Now what I want to do is to configure an application in order to configure an application. I have to type in no package manager in it. This is the comments that I leave to configure a new application. Now I hit enter and let's see what happens. Well, now, as you can see, no puckish man a year is asking me to provide a package name. So in this case, I want to set the option off this property to the I have. I want to set the value off these property. So the default value. So now I hit. Enter now. No package. Man a year is asking me to provide a version. I want three default value for this property. So I Heat centers now is asking me to provide a description of the application on the description will be my first up, my first with, uh, now I hit. Enter now. Ah, no puckish man a year. He's asking me to provide the entry point. The entry point can be considered as the most important application The most important file inside my application. So in this case, I want to name such file as server dot Yeah. Yes. Now heat enter. Now It's asking me to provide a test Comment I don't want to provide. I don't want to provide any team. I don't want to provide it. So I hit. Enter again. Enter now. No puckish manner. Your is asking me to provide keywords that describe my application in this case, I'm going to use no. Yes. And first with those are my keywords. Now I heat first with AP. Those are the key words. Hit enters now North puckish man a year is asking me to provide the out of this application . In this case, I'm going to type in my name. Which is, uh, Raimundo. Keep interest. Enter again on now. No, no package manner. Your is asking me toe is asking me whether this is okay or not. In this case, I'm going to bean. Yes, he's okay. Now eat interest on that. You can see the configuration file has been created. Now I have to do is to navigate toe opened my ghost writer. Now the ghost writer that I will be using is, um, supplying text. So what I have to do is to open the blind text both fighters on, uh, after I opened Theseus. Blind text. Koth Writer. I have toe opened the I have to open the folder. Well, guys, now, as you can see, I am inside. Uh, sublime text Andi, I would have to do is to open the directory that I just created So I select the menu file. Then I select the option open folder. Andi, I have to navigate to the folder or directory that I just created. So I have to select the option. Ah, the stop. And then I remember that the name of the directory is first up. So I have to look for such directory. I selected the directory and select on. Now I heat Enter on. Let's see what happens now. As you can see, a new a new window is opened on. What I have to do now is to I'm going to open the file. Backlash, Backlash Thought Jason, It's important to say that this file back cash that Jason Waas creative, um so was created with the settings that we provided to the command prompt again this vile Pakis Jason, because Jason was created with the settings that we provided to the comments prompt. So you can see here appears the name of the application which is first at we have the description, which is my first weapon up. We also have a property name my property main that contains the main file for my application in this case server Dodger. Yes, and then we have the key works as well. So on the altar, which is right, Mondo, which is my name. So now I have to do is to create the most important file in my application, which is service So jealous. So I'm going to save this file us a server. Oh dear. Yes. Now I hit Enter and now I have to do is to open the command prompt on What I want to do is to install my first dependency. So I know that we style our dependency. I have to type in no package, man a year in style. Double dash, save Andi, I have to you when I want to use the dependency express expresses a dependency that enables you to create your server side applications. Okay, express is the dependency that enables you to configure your server on to create your service side applications. So this dependency that I need So I have to like bean, have toe press, I have toe hit. Enter on. Let's see what happens. Well, now you can see North package manner. Your is installing the express that pendency. Um this process takes a while, so I have to escape this part of the process. But, as you can see, expresses being in south inside my project. Well, as you can see, the Dependency Express has already being installed inside my project. Now I have to do is to close the command prompt on If I scroll down the Packers. Jason file, you can see that there is property called dependencies on this property contains the express dependencies. Dependency on according to these were juicing the version 4.17 point 1.1. Now what I have to do is to create my first up eso. What I have to do is to declare the dependencies that I need. So I'm going to type in a comment the 10 then seize on three dependencies that I need the first dependency that I need for my application. Toe work is expressed, so I have to declare a constant express on its body will be said toe require express. These statement enables you enables and my application to use express on now. What I have to do is tow create another constant. This constant will be the up constant on its value would be said to express, uh, followed by parentheses, now what I have to do is prove it clear. Um is to declare another dependency. Well, not no, I don't have to declare another dependency. So far. It's older that I need now what I have to create East my first Roath. So I have to create a comment wrote on, in order to create a road without toe typing up the get on. Uh, if you guys are wondering, what are the roads roads describe what happens when the user be seats are given address in the browser again, Uh, roads describe what happens when the user be seats, given you are l address by using the Web browser. So in this case, when the user, um, busy, it's the address slash. Hello, then wake up to describe what is going to happen or what is going to be displayed. Toe the browser when the user base its day. The u R L. That is slash. Hello. So probably you guys don't understand it on, but I don't worry. Request on way have toe now inside thes dysfunction. We have toe asked two parameters. One is request and the other east response Now probably you guys don't understand what is happening here but a science there. As we start creating applications, you will understand roads. Very well. Don't worry. Now what? I want East toe to sent a response to the browser and the response response Well will display Ah, hello World message today to the browser. So I have to create the hello world message, as you can see. And now what I have to do is to configure, deport uh, that will be used to create a connection between the browser on the server. So I have to take me in the listen and then 3000 and then I have to create a narrow function like this. And if everything is working, I want that a message is displaced to the console. Andi, such message will be listening. Look out, Post 3000. Well, uh, probably you don't understand all of these, but basically, we are setting up the port that will be used to establish a connection between the browser and the server. And if everything is working, then the command prompt. Most displayed the massage, uh, listening at local Khowst 3000. Will, um Now, what I have to do is to run my application so I kept taping, knows server doctor. Yes, I know Hit Enter and let's see what happens. But you can see the message listening at Look at a look at local host 2000 appears which means my application is working. So now what I have to do is to 19 local coast local host 3000 slash. Hello on then let's hit, enter and see what happens. As you can see the hello world, Miss Ash appears in the browser, which means that my first application using express and no Js is working. So, um, basically, as you can see, um, the road describes what happens when the user be seats are given you are ill a Web browser . So if the user BC, it's local host is lash Hello then. Ah, our response is sent back today with browser And in this case, the response is Ah, hello World message again If the user be seats. The view the u R l local host 3000 slash Hello. Then a massage is sent back to the browser and search Massage is hello world. You seen feather one tax on a report. We also have to configure the port that will we use to establish a connection between the Web browser on the server. Now, before I finish this lesson, I just want you to pay attention. Toe the folder that was creative to these super directory that was created to the left side of your screen. There is a folder called Normal Use. This folder contains all dependencies that were installed, um, on that are necessary for our application toe work. It's important to say that all these dependencies are reduced by our application on all these dependencies were downloaded from the Internet automatically when we installed the express dependency. Well, guys, on basis it for this lesson on In the next lesson, I will show you more about no Js on express. 4. StaticServer 3: welcome guys to another lesson off this tutorial. Well, in this tutorial, what I want to show you is held to create what is known as an ecstatic process asana static Web server in order to create an ecstatic web server. What? I need east that what I need ease, Uh, four pictures about animals. So in this case, I have four pictures about different animals. As you can see, I have a horror. Have horses, although a cat as well as a Valium. So what I have to do now? East toe, save these pictures inside before they there. The root folder for my project. So what I want to do now is to toe hit over to my toe, took it over to my project on what I want to do is to create on your soup directory. So I'm going to right click over the root directory, and I'm going to select the option new folder. Now, what I want to do is to create a subdirectory called Ah public. Now I hit. Enter on what I want to do now. East toe safe. These four pictures inside the public directory. So as you can see, I'm going to right Click over the picture on what I want to do us, I said, is to save these picture inside, um, inside the soup directory boutique. So, as you can see, I am navigating toe the root folder for for my project on um Well, remember that the root folder for my project ease. Ah, ease before there. Well, first up, so I have to select the folder on now. I have to select the diesel directory public on now inside the suit directory. I'm going to say this picture us Alyan. No heat safe on. If I go back to the court Writer, you can see that the picture off the lion he's already inside my project. So now what you have to do is to repeat these These steps for each off the off the off the reminding pictures. So safe the pictures inside your project. OK, guys. Now, as you can see, I have four different pictures off animals inside my project inside the public, So directory I have the cut picture the dark picture, the horses picture on the Valium picture. Now what I want to do is to get over to the server toe Js doc Js file on Remember that thes ease the main file off my application Now what I have to do east to, um is to declare another dependency. So I have to create a constant on such such constant will be bad. I saw you have to take on the value of this constant pat will be required. But now, uh, as soon as you can see, I didn't I did not installed these dependency path inside my project by using the command prompt. So in the previous listen, I have to use the comments prompt Do in style the express dependency. But in this case, I don't use the common problems to install the path dependency on the reason for that East . Yeah. And the reason is that the path dependency, the but dependency is already included. We'd know J Yes. Again, this is very important. The but dependency is already included with Jammeh. Sweet. No genius by default thing is very important to say, because there are two types off dependencies. Some dependencies must be in styles inside your project By using the comment promise on other dependencies are already, um included Wheat Note J Yes, So, uh, the path dependency is a dependency that he's already included with no j yes, by default. So after these, well, I can't continue creating my application on what I want to do now is to create an ecstatic Web server. So I think I create a comment aesthetic work server on now, in orderto create it to create an aesthetic web server. I'm going. I'm going to 13 up use and then express those is study. Okay, that s static on. Then what? I have to, you know, wanna have to do now east to a specify the bat toe the public directory. So in order to do it, I have toe being bad thoughts. Join on, then the constant V early Constant. Your name contains the pat. So the root directory. Now I have to specify the directory that contains my ecstatic files. In this case, the directory that contains my aesthetic files is the public subdirectory. So now it's time to check whether my aesthetic web server is working or not. So I have to go back to the Commons problems and I have to stop the server in order to stop the server. I have to press the keys. Control. See? Again, This is very important. In order to stop the server, you have President Keys Control. See? Okay, this is very important. So I press control, see? No, What I have to do is to restart the server so that they'd be no server. Yes, I think enter on. Uh let's see what happens. I think the comment prompted displaced the massage, listening at local host 3000 which means my application is working. Now. What I have to do is to take the local host, uh slash. And now I have to take being the name off a picture. In this case, I'm going toe type pain Lilian, the extension of the file. And then he entered. And as you can see, the picture off the lie on this place. Now, if I think being local host 3000 slash horses dot the extension of the off the picture on then he'd save the horses. Picture is display Now. If I take Dean, look, a host 3000 God, I thought the extension of the file You can see that the picture off the cat is displayed on if I take being local host 3000 slash I thought the extension of the file and then I hit Enter. You can see that the picture of the dog is displayed. So this means that my aesthetic web server is already working on well in the next Listen, I will continue workinin on these application. 5. StaticWebpages 4: welcome guys to another lesson off these tutorial. Now in these Listen, I want to show you how to display HTML files toe the browser. So in order to display HTML files to the rouser, the first step is to right click over the root folder on. Now you have to select the option. New folder. Now you. Now these new folder will be called HTML. Now hit. Enter on that. You can see without a news of directory. Now, what I want to do is to create four different HTML files. So I right click over the HTML subdirectory on. I'm going to select the option. Your fire. Now, what I want to do East to safe. These file asked that thought html and then he entered. Now, as you can see, I have a new HTML file. But now I have to create a very basic markup. So the title for for this file will be cat on. Now I want to display a header one time. Uh, that contains the text got on. Then what I want is toe other pictures. So I have to include the pat toe. The picture that I want to display in this case I want to display the picture. Got caught The extension of the file. Now what I want to do is to create a copy off these file. So I'm going to select the file menu, and I'm going to create to select the option safe us in order to make a copy off this file . So what I want to do is to cold is to create a copy called Lion. Now I heat safe now. As you can see, I have the copy off the file. Now. I just changed the title to William the Heather to Lyon as well. And now I'm going to change the name off the picture toe lion as well. Now what I want to do is to repeat the process. I want to create a copy of this file. So Ah, in this case, the copy will the the name of this new HTML file will be a horse. Now I enter. And as you can see, I have a copy off the but the office knew of these. I have to have a copy of the file. Now I'm going to mean at this file horse courses on got to change the other one at directory Two courses, Aunt. Now I have to change the, uh, the name of the picture toe courses as well courses. Now he'd save. I know what I need to do is to create another copy of this file a copy of this file. So I select file, then the options save us in order to make a copy off this file. And I'm going to name this file us Doc. Now I get inter on now I have to do east to replace the title wheat dough. And now they want that we'd talk as well. And now I have to replace the picture address toe Doc, I thought the extension of the file now, as you can see, I have four different HTML files is the cut html file the html file BC's the the horse HTM of file on This is the laon html file. Now what I have to do is to go back to my server DOJ Yes, folder on now, what I have to do is to create four different roads. So I create a comments. Roads, ropes and, uh remember that roads describe what happens when the user BC it's given you are l address or what happens when the user base it's a given with page or what they wrote describe what happens when the user, uh, the seats or are given you are l address in the browser. So I'm going to the beat up thought Get on, then the address will be a slash um, got So when a user opens the browser on B C, it's the you the the address Local host 3000 slash cat. Uh, this is what is going This something will happen on, um, description off What happens is included inside this function. So these are a function contains the the Objects Quest on response. So again, when the user opens the Web browser on B C, it's the address local Khowst 3000 slash cat, then something most happened on what we want to happen is that the server sense response on a such response will be to send a file. In this case, the file will be on html file. So and now I have to tow includes the pat toe, the HTML file that I want to display in this case, I noticed to describe the path to the HTML file. I have to type in a bath adult joint, and then the constant urinating on. Then the name off the file on that I want to display the route. Sir, In this case, the file is, um this piece stored within the HTML. So directory. So with 18 HTML is slash ah, got boat The extension of the file. So again, when the user base, it's the other s a local host. 3000 slash Got, uh, on html file is sent to the browser as a response on Well, in orderto well, what I want to do now is to create well, but I went to the Now is to check whether all of this is working or not. So I have to go back to the Commons prompt on. I have to stop the server. Remember that in order to stop the server, you have to press the keys Control seat. Now I have to restart the servers. What? They mean No server Dodger. Yes, I hit. Enter on. Let's see what happens. A So you can see a probably command prompt this place This place they may such listening at local host which means everything is working. So now I'm where I want to do is to take means local host without senate slash that on DNO heat in third and let's see what happens. Well, as you can see, there is a a small issue we'd thea address. So there is a problem with the address, so I have to go back to my application on, uh, what I want to do now is to change the the file extension toe html Sorry, I made a mistake. Now I say the changes to go back to the common prompt. They stopped the server by pressing the keys controversy on. Now I have to restart the server against hit, enter and let's see what happens. You can see everything appears to be working. Now I go back to the browser on being local Khowst 3000 slash cat. Now let's see what happens As you can see the picture of the cat displace as well as a tailor. Now what I want to do is tow Create three more roads like this. So I have to copy this road and I'm going toe placed these road three times four times on one more. Thanks. Now I have to change Cat in the first. In the first copy, I have to change. Cut by, Uh, doc, I thought I'm going to change the HTM the html file to duck as well. Now what I want to do is to change card. We'd lion, and I'm going to change the html file toe lilian dot html Now what I want to do is to change the cut address with is to replace the cut address with the address slash force courses. And now what I want to do he's to display. They gauged him the HTML file horse. Now I heat safe on now. What I want to do is to go back to the common prompt, honest, off the server. Remember that in order to stop the server, you have to present keys controversy. Now we stop the server and I would start the server hit, enter an upper, and as you can see, everything appears to be working. So now I'm going to take being local host 3000 slash go. But so really slash Go. He's enter. Ah, let's see what happens. But you can see the picture of the talk this place Now what I want to happen is toe what I want. I want to die peen a local host 3000 slash lion hit enter And as you can see, the picture of the lie young This place now what I want to do is to type in local host 2000 slash courses I get in third. How did you can see the picture of the horses? Thats place toe the toe the rouser. So this is it for this tutorial. Guys. Now you know how toe create on ecstatic Web server and help to create, um, roads that display HD email files. So this is it for this lesson, guys on, uh, in the next Listen, I will continue. Um I will continue. Um I will continue teaching you more about no Js on express. 6. HandleHtmlFormsPart1 5: Okay, guys, Welcome back. Welcome back to another lesson of this tutorial. Now, in these listen, I'm going to show you how you can, uh, handle the input from an from HTML forums. So in order to understand how to handle the input from HTML forms, the first step is toe create a new project. So again, what I what I want to do is to create a folder inside the disk top off my computer. In this case, the name off the folder will be HTML forms now. He'd save I hit. Enter on now. As you can see, I have my new folder creators. Now I have to go back to the common prompt. I'm going to a stop the server. Now what I want to do is to navigate toe the toe this directory that I just created. So I think being change directory double dot It slash now, as you can see, am inside the risk. Stop Now. I have to take being change Directory. Uh, html forms now heat inter. And now you can see as you can see, I am inside the directory that I just created. Now what I want to do is tow is to create the configuration file for my application. Remember that in order to create a configuration file, I had to be no back Cashman a year in it. This comment is going to create the PAC cash Gaze on file. Remember that the PAC cash gaze on file contains all the settings for my application. Is the brackish case on file contains a description off my application on the backlash Jason file is created by the comment. No, the package Man a year in it. Now I have to keep enter on Let's see what happens. Well, guys, now, as you can see, North puckish man a year is asking me to provide a backlash name. So I hit enter so that the value for these setting east the default value so I hit enter again is asking me to provide the version. I want to set the value for these setting us three the fourth value. So I hit. Enter a description description will be HTML forms. Now it just enters entry point. Remember that entry point describes the name off the main file inside my application in these cases server dot yes enters center on then I know package money. Your is asking me to provide keywords that describe my application. Such keywords are html. Ah, the only person for the parcel, which is the tendency that I will be using on equal as well. Now I hit. Enter on now is asking me to provide the outdoor of these application. In this case, adultery is my name Training Doc. I hit. Enter now. Answer again on DNA now. Finally, a no package man a year is asking a question. Is this okay? I think being just hit, enter. And as you can see, the configuration file has already being created. Remember that these, uh, after all of these backlash Jason file is created. Now I have to go to the coffee writer on. What I want to do is to open the style that I open the directory that I've just created. So I have to navigate to the top, and now I'm going to look for the folder HTML forms. I select this folder. Now you can see a new window opens on inside these directory. There is a packers Jason file on this pack. A shezanne file contains the description off my application As you can see, this practice chase on file contains the settings that I provide it. Ah, you seen the comments prompt. As you can see, this file contains the name of the application contains the main file, which is server Dodger. Yes, contains a description of the application contains the outdoor, which which is right now you know my name and also contains keywords that describe dedication. So this fire was creative with the settings that I provided. You seen the comment prompt? Well, and now what I have to do is to install the dependencies that I need. In this case, I need a dependency. In order to install the dependencies that I need, I have to type being no puckish man a year in style, Double dash save expressed his independence the first, the first dependency that I need to create the the server side applications. Now I need another another. Another dependency. Such dependence three East 40 purser's on the other body parts er is a dependency that enables you toe handle. The input that comes from from the HTML forms again for the purser is the dependency that enables you to handle the input from the HTML forms. Now I hit. Enter on. Let's see what happens now. As you can see about the north packets matter. You're eating Stalin. He dependencies. Onda thes process takes a while, as you can see. So I'm going to escape this part off the process. Now what? You can see the dependencies have already being installed inside my route. My project. Now, if I opened the Pakistanis on file, you can see that the dependencies property, the dependencies property contains toe dependencies, the body parts of dependency as well as he expressed dependency on on. Now what I have to do is to create the main file for my application, which in this case must be cerebral. George, a guess as described by the Pakistanis on file. So I'm going to write quick, they root folder and I'm going toe select the option you file and I'm going to save this file as a server. Yes. Now I heat enter. And now the first step is toe the clear. My dependencies. What? They mean the pain then sees the pain on. I create the Constant Express Undated. The choir, uh, express its will on and then other constants Uh and its value will be said to express parentheses, then, uh, constant. But remember that the bad dependency, dependent dependency is a dependency that comes. We know J Yes. By default. Now, another dependency that I need these boy part, sir. So they being const body sparser equals require Ah, Ali Parsa quality car search now, uh, what I have to do East toe Configure a body part, sir. So I'm going to create a comments. Can feel your both the bar search now in order to configure body parts that have to be nap use on bein a body part. Sir, though you cartel encode it, you are ill in cold. This, uh, now, uh, the property extend thin, uh, force. Okay, on now I have to add another line of code after the EU's Sorry have the juice body purser, though. Jason. Well, thes two lines of code are very important because this is the way how I can configure body parts, sir. So you have to use these two lines of code every time you use for the part, sir. And now, um, Okay. Now what I have to do is to create on a new suit directory. So I'm going to select the option. Your folder on the directory is HP and Mail on. Now I have to do is to create an HTML file inside the suit directory. So I select the option you file on. I'm going to say these html file as form the HTML now heats it entered. I have to create a very basic Marco eso in this case and the title of these fire will be form. This fight will contain a hater. One attack with the text form as well with personal persona information. Now I have to create from tax. Okay, the form tax way contain the attributes. Metals said toe post Andi etiquette action said toe slash Ah, you boot. Andi. Now where I want to do is to create, to continue creating my my form. So I want to ask a paragraph. Actually, they went toe four para wraps like peace on the first paragraph will display the name us along with an input on a text field. Sorry. On the name off. These, uh the name of these input. The name of this text field will be looser name Now. I want to copy this code. I'm going to play states like this both in this case, the second paragraph we contain the gender on the name attribute will be set to user gender . Now again, a cookie basing this coat. But these new paragraph will contain the country on the input. The text field will have three name attributes said to you, sir, Country on again. I have toe based. I have to bow service ary I helped tow. Okay, I have to copy. Sorry. I have to copy this code on. Uh, I'm going to paste it right here on these new, uh, final grab will contain the Asia off the user. So, uh, the text field, we'll have a name. Attributes said to you, sir, Asia. Now what I want to do is toe of a boot on. So it 18 input like s oof. Meat on the value of these Bhutan will be stand information. Now, I he'd save on uh well, I think this is it for this lesson. Now, in the next lesson, I will continue working on these, um, on this application 7. HandleHtmlFormsPart2 6: Well, guys, welcome to another lesson off this, Victoria. Now, in this lesson, what I want to do is to continue working on the on the application that I created in the live in the greatest lesson. So as as as you know it, I have an HTML file that contains a form. So what I want to do is to create a road for my roads. So I'm going to add a comment. Roads on. What I want to do is to create a road that this place the html form to the browser. So I'm going to be up. Get on Thea. Others will be a slash, um, is slash you think? And now I have to create what is known as a natural function. And these are a function contains toe object. The 1st 1 is Arab. The request object on then the response. And, um what I want to go now? East toe, send the html file Asare response from, like, baby in response, but, uh, saying fire on, uh, now I have to use, uh, the dependency. But on the intimate off joint on the's, metals will contain the constant your name. Remember that this constant fear. Main contains the path toe the root directory. Now I have to a specify the file that I want to display to the browser such File east. Uh, it's a start in the HTML. So directory. So I take being 80 html it slash ah formed out html form the html. No. Uh, Now what I have to do is to scroll down the this the screen. I'm going toe set up the the board. So have bean are the Listen on. I'm going to specify the port that will be used to establish a connection between the with browser and the server and the server. So I think being 3000 then another arrow arrow evolution on. If everything is working, then I want a Miss Ash to be displayed to the council. So it seems console. I don't know on the message that will be displayed to the console. If everything is working, he's listening. Uh, look out, though. 3000. Now, what I want to do is to go back to the comment Brahms and I have toe. I want to run this application. So I couple 18 knows server no dot Yes. Now he enter on. Let's see what happens. But you can see the message listening. Look at a local Khowst 3000 he displays, which means everything is working. Now I have to go back to the browser and I'm going to take being local host. 3000 slash improves it slash input. I hit. Enter and, as you can see, be three html form he's displayed. Now what I want to do now. East toe atthe on Aesthetic Web server So it 18 comments with server on in order to create the aesthetic Web server, have typing at the use Ah, and then expressed those static on again. I have to use the the bad dependency. So it 18 Pat and I have to use the joining metal. And I have to provide two parameters. One East your name that contains the bat toe. The root directory on the other is three other parameter is the folder that contains my aesthetic files. In this case, such folder is the public folder. So Well, as you can see, I don't have a public folder, so I have to create it on. I kept to right click the root folder and I'm going to select the option. Your folder. I'm going to take being pulling now. Hit! Enter on that. You can see the public subdirectory has already been created. Now what I want to do is to create a CSS file. So I wrecked like the public folder. And I'm going to select Thea Pe'shon. You smile on. I'm going to save this file us. My style's tortoises hit. Enter now I want to do is to apply. Ah, What I want to do is to apply so much styles to the heather one that, as well as Thomas ties to the para wraps inside the HTML form. So I have to type in care one on. I'm going to set the color toe. Okay, Blue on now I have toe create another style, but a wrapped and I'm going to set the color toe rest. Okay, These are very simple CSS file. Of course, he's only to show you how toe how you can use the static files. Ah, now I have to get over to the to the to the html file and I'm going to link my styles, so I have to use link. And then, of course, I kept toe. Specify the path toe the CSS file, uh, such but will be my styles. CSS Okay. Now, uh, I say the changes on now I have to go back to my common prompt. I have to stop the server. Remember that in order to stop the server, you have to press the keys controversy. Okay, present his control. See, in order to start to stop the server. Okay, so now I present keys Control. See? Ah, Now I have to start the server. So I think bean knows server dodgy. Yes. High heat in there on everything appears to be working. So now what I want to do is to refresh. Let's see what happens. Okay. As you can see now, uh um, I form has some very basic styles, so my styles are working so far. And now what I have to do is to, um but I want to do now is to get the information from the form. So if I analyzed the html form, you can see that these farm uses the post metals to send the information to the server. So I have to create a road that, uh, candles deposed metal. So I have toe bean up the post. These road You said you says the post metals to get information from the browser. Now what? I have toe had to go back to my HTML code on that. You can see these form H these HTML form since the information to the address slash input. So I have to go to my app on I'm going toe specify such address. So I think being a slash team pulled okay. And now I have toe create theory functions and I will be Zahra functions have two parameters. The first parameter is request. The second parameter is response. Now what I want to do is to get the information to get the information from the from the html form and save the information inside variables. I'm going to create a variables what they've been let name let the body will named Ah ah, The variable name will be equal to request the body dot on now. If I go back to my html code, you can see that the text field for the name has theatric viewed name said to user name. So I stopped to go back to the said we're on 19. Don't you certain? Now what I want to do in orderto test whether my application is working or not, Please to send a message to the council. So I think being counselled not love. Ah, the name he's a space on. Then I have to You grew the name so um atyou can see the name the value off the name text field for the value for the value off the text field that contains the name will be saved inside the name variable on. Then the value off these variable will be displaced to the council. Now what I have to do is to stop my server. Well, guys So what I have to do now is to stop my server. So I have to press the keys. Control. See Ondas. You can see the server has stopped and now I have to restart the server in orderto in orderto Well. I have to start the server on now. Now have I mean note server DOJ? Yes, I hit. Enter on. Uh as you can see, the message displaced the console, which means everything is working Now I have to go back to my html form and I'm going toe. I'm going to feel the text field for the for. I'm going to feel in the text field for the name. So that mean, uh, Nicole the corner Now I pressed the button. Send information on. Let's see what happens if I go back to the council. As you can see, a new message is displaced on. The message says the name is Nicole. Natalie? No. Which means my, uh, my application, he sable toe get information from from the HTM html form. So as you can see a message, this place Andi massage says the name is Nicole. A little, you know. So that means my application is working. No, Uh, we'll have to do is tow safe, um, to create three more variables. Andi, I have to create a variable that a store, the gender. So I didn't begin there on its belly will be said to request that body thoughts on. If I go back to the to the html code, you can see that the text field for the gender has the attribute, use or gender. So at the bean that you sir, gender again another another variable The variable come free on its value will be set through Request that body dot If I go back to my, uh my html code, you can see that they text text field for the country has the attribute user country So I had a bean dot yusor country and now I want one more variable Let the valuable age explain it will be set through request the body dot If I go back to the coast to the html code, you can see that the text field for the age because theatrical name said to user age. But you, sir eight on Well, guys, as you can see all the information that is sent by the HTML form now, um east stored inside these four variables Now in the next Listen, I will continue working on this application. 8. HandleHtmlFormsPart3 7: Well, guys. And now, in this lesson, I will continue working on the application that handles they input from the HTML form. Now, what I have to do is tow Start creating. Um does start creating the output off these application. That is, I have toe better. Mind what's happ what happens after the user since the information by using the HTML form. So in order to do it, I'm going to create a variable output on. What I want to do is to set the value off these variable too. Ah, twice drink on a visa Streams will contain some html Marco on the html Marco will contain the values off the variables. So I want the output Will be Heather one attack Andi Thies Killer want that we content will display the name they will displace. Uh, Bijan there begin gender on in another line. It will display the country on ah means another line. You will It will displays with this play the change. Now what I have to do is tow place the values off the valuables off the values of the variables. So I'm going to ask variable here. I'm going to ask the name variable here. Andi, I also want to ask ah agenda valuable here as well get gender. But they being gender now. Uh, what what I want to do is tow at the country. The country variable. So they mean country. Andi Finally, what I want to do is to ask the value off the age of the age variable. And now, in order to send thes thes output today. So the browser what I have to do is to be in response. Don't sent response, not saying on. Then I have to place the variable output. Now I say the changes and I have to go back to the so the comments prompt. Now what I want to do is to stop the server. So in order to stop the server, I have to present keys controversy. So I present is controversy. And as you can see, the server east stopped and now I have to do is to restart the server. So in order to restore the server, I have toe state. He knows several dodgy. Yes, I heat enter. And now let's see what happens. As you can see. Ah, research this place to the common problems which means everything is working. So now what I have to do is to go back to the Web browser and I'm going to take being a local coast. It slash input. Now I heat Enter on. Let's see what happens. As you can see the farm, this place Now I'm going to feel in the information I'm going to feel in the text fields. The name will be Nicole. The gender will be a female. The country will be Mexico. On the age will be are No. 55. Now I pressed the button sent information on. Let's see what happens now. As you can see the input this place in a new with browser page on. Uh, this This means that my application is working. Now you have understood how toe pass information from the browser to the server by using HTML forms. And um yes, I think, um, I think this is it. His visit for peace application. Now in the next. In the next lessons, I will continue. Um, I will continue showing you more about, uh no Js and express 9. ConfigureEJS 8: welcome, guys. Toe Another lesson of this tutorial. Well, in these listen, I want to show you how to use template engines. So in order to show you how to use template engines on what I want to do now is to create a new application. So in order to create an application, but I want to do is tow create a new a new empty folder inside my desktop. So, uh, the name of the folder will be, Ah, template engine. Ah, Now I heat in there. Now what? You can see a new empty folder has been created inside the disk top off off my computers. Now, what I want to do is to open the command prompt. I have to navigate through these supplies to this directory. So they being change, directory the stuff and then change directory template engine. Now heat enters I. And as you can see right now, I am inside the directory. Now, what I have to do is to create the configuration file for my application. Remember that the configuration file for my application he's three. Bacchus chase on file on in order to create a backlash. Jason, file, I have to um, toe typing the government. No Pakistan a year in it. Now I heat in there and let's see what happens. Well, guys, now, as you can see, no package manager is asking me to provide a package name. So I want to say these property to be the false value. So I hit Enter again. He's asking me to provide the version. I want to set the value off these property to the default value. So I hit. Enter now I want to but I have to provide the description for my application. In this case, the description will be template engines. Now I heat enters now no package manager is asking me to provide the entry point. Remember that the entry point is the main file inside my application. Such fire would be server Dodger. Yes. Now hit Inter Now I hit Enter again and hit Enter again Now have to provide the key words In this case the key words are then played engine on a year Yes. Age Yes is the template engine that I will be using Took out these these lessons. Okay. A j yes. Easy template engine that I will be using to create my application now, like it enters now, another package manager is asking me to provide the outer. I'm going to type in my name, which is right, you know. Now I hit. Enter. Enter again Now. No puckish manager is asking me a question. Is this OK? So I had to like being Yes, this is OK. I hit Enter and this is it. I've just created my configuration file. In other words, I've just created the backlash. Jason, file the file that describes my application. Now I have to open my coat later on. What I want to do is to open the before there eso I have to navigate to the folder on another to navigate to the folder. I have to choose that the stop on and I have to choose the father. I have to choose it for their template engine. Now I select this folder, and as you can see, a new window appears. Now what I have to do is to Well, I'm going to open the packers. Jason file on now, As you can see, the Packers Jason file contains a description off my application. As you can see, it has the description of my application because it defines the main file, which is several genius as well as a key words. The outdoor weigh the value off the outer is my name. So, as you can see, these five contains a description of my application. Now I have to go to the comment prompt. And while I kept, what I want to do now is to install the dependencies that I need to create my project in this case. And I have to install three dependencies. So I'm going to be no package man a year in style, in style, double dash safe. I need to Dependency Express. Remember that. Remember that expresses the dependency that enables you to create service side applications . I need another, uh, dependency. Which is the body part, sir. Remember, the holy purser enables you to handle the input from the HTML forms on now. I also need a new dependency on the dependency East Asia. Yes. A year. Yes. Is the template engine on template engines basically enabled you toe pass information from the server. So the browser Okay, basically, that's what they are able to do. Template engines enables you toe pass information from the server to the browser. Well, now I heat in there on. Uh, let's see what happens. Well, now, as you can see Well, now what? You can see the dependencies have bean in style inside my project. Now, what I have to do is to close the command prompt on if you scroll down three fire backers. Jason, you can see that the dependency entry have a dependency. Property contains tree three entries. One is really part, sir. The other is Agent. Yes, and the other is express. So it means that our dependencies are ready in stuff. Now what I have to do is to create the main, even the main file for my project in this case, such file East server Doctor. Yes. So now I heat interred. I know. What I have to do is to define the dependencies on a side. These in previews lessons I have to include I have to create to declare a constant in this case in constant East's express. Andi, I have to take being require express express on now I have to create another constant. As I live in previous lessons, the constant is up on its value. Will be set to express on its parent disease on. Then I have to declare another constants the constant spot on going to require the path dependency. Remember that the fat dependency comes within Algeria. Yes, by default. No, Uh, what I want to do is to create another constant for a deeper search on behalf of being require. Ah, both the person. Okay, now what I want to do east to configure body parts er's so I have to create a comment. Confused. So I have to create a comment config your for the parson. I'm now in order to configure, will the parts there happen? Typing up the juice? Uh, body parts, sir dot Uh, you are l and go and go Death. Ah, extended extended force. Okay. And now I have to have another line of the jews. Body parts, sir. Both Jason. Okay, now, as you can see, I just configured body part, sir. Now what I want to do is to create um ok, what I want to do is to create I wrote some. What do they mean? Roads. Aunt's. I'm going to create our road for the address. Ah slash Input on. Now what I What I have to do is to create the arrow function and remember that the arrow function contains two parameters. Request on response on. Well, basically, what I want to do is to um what I want to do. Where? Before these. Sorry. Before these I have to configure Ah A J guess as well. So remember that a year Yes is my template engine. So now what I have to do is to configure a year. Yes. So I create a comment. Config your a j Yes. So, in order to in order to configure a year Yes, I have typing up the set. Ah, abuse. Andi, I have toe specify the folder that will contain will contain my abuse. In this case, such folder will be the abuse. So that subdirectory off course. As such subdirectory does not exist. I had to create it later. Ah, Now I have to take being upset and then specify the view engine that I want to use this case. I want to use the View engine A Yes. So, uh, now where I have to do is to create the A J yes. Of directory like these? No, I have to create the abuse they've used to suit directory. So I called the zoo director. Reviews hit. Enter. I know what they want is to create a new HTML file inside the abuse subdirectory. So are they being Ah, hello. Hello. Nursery input dot A Yes. Now it is very important to say that the file content this file contains HTML code, but it has the extension. It has the extension dot A year? Yes. This is very important on your file contains HTML markup. But the extension of this file ease dot A Yes, you're so pay attention to the extension of this file. Ah, Now, uh, these with Peixe will display either one that says hello world. Okay, now what I have to do, he's to go back to my Surber on I have to go. I'm going to change the address to hello On what? I want to happen east to send our response And then I'm going to use the render method And I have to specify the template that I want to use in this case. I want to use the template input that a yes. Now I said as I finally step, I have to configure the port apple bought. Listen, remember that the poor would be 2000 then I have toe display and my such to the concert. So I think being console, look on least sinning at local host 3000. Now what I have to do is to say the changes go back to the common front. Andi, I have to run this application. No server dot Yes, I heat and and let's see what happens. As you can see, everything appears to be working. Now I just have to go back to the browser and type mean local hosts 3000 slash. Hello. And now let's see what happens. As you can see the hello world, Miss Ash, this place to the rouser, which means my obligation is working so and now you can see I've just used the template engine toe display on HTML filed to the browser. Um, well, now you know how to configure a template engine. Ah, but in the next lesson, I will explain more about this 10. TemplateEngines 9: Well, guys, welcome back to another lesson of this tutorial in this lesson. I will continue working on the on the application that handles age, I guess. Uh, now what I want to do is to wake some improvements, toe the application. So I'm going toe remove the address. Eyes slash. Hello. I'm going to use the addresses slash in boot. Now, what I have to do is to go back to the common problems and stop the servers. Remember that in order to stop the server, you have to present keys control. See? So I pressed the keys controversy. Now you stop the server. And now what I have to do is to restart the server so they'd be no sir Brittle J guess I hit. Enter and let's see what happens. Well, as you can see, a new message displaced this place, which means everything appears to be working. Now I go back to the browser and be local host 3000 slash He put it slash Input on. Now I hit. Enter on. Let's see what happens. As you can see, uh, the same Hello world massage. This place, which means my obligation is working now. I have to do is to go back toe. My growth on what I want to do now is to create a form. So I'm going to remove the title and I mean personal information as the title of my webpage . And I'm going to remove the heather. I'm going to replace the heather wheat. There's, you know, information as well. Now what I want to do, as I said, is to create a form eso I'm going toe the form tax on, and I have to specify the method for the farm. In this case, the method will be post on the actual natural route. That and then the value off this attribute off the action a trade with the value off the action attribute will be set to a slash, um is lashed display. Okay, now what I want to do is to ask for perhaps inside my my form like this. Andi inside at the first photograph will display the name on. I want to create a text field. So I have. They then put back on in order to create the Destexhe Field Theater tribute name. The name attributes for these text field will be a set toe user name. Now what I want to do is tow toe, place the course or inside the second paragraph on I'm going to take being a country. No so region dish I'm now I want to create another text field on the attribute name will be set to use er genders. Now what I want to do is to place a course or inside the third paragraph. I'm going toe, uh, typing age. Andi, I have toe have a text field. So the attribute name will be set toe yusor cage. Now I want to ask Ah, another another partner up on it says the dealer Parrot contains Conte country on I'm going toe fixed field. Andi But the attribute name will be said to you, sir. Ah, country. No. Well, now what I have to do as a final step is toe. Asaf, meet Bhutan. So they've seen on input. I have to create a bhutan to suit meat. This information to send to this information today to a server so that we would the type off these good tone will release of meat on the value will be, uh, they really will be set toe sent information Now I say the changes and I have to go back today with browser on. Refresh the page to see what happens now. As you can see, everything appears to be working now what I want to do east toe, um, to create an aesthetic server on the static web server. So what I went toe do is to add another comment create Well, it's nothing Web server. Is that the We're server now, as you as you know it. In order to create an aesthetic web server, I have to use at the juice. Ah, then is express that static on inside thes static metals. I have to specify two parameters. The first parameter is ah, their name on the seconds and also resources. Now, inside the systematic middles, I have to use the bad thought. Join Meadows on. Uh, what I want to do is to specify the constant dear name. Remember that this constant contains the path to the root folder on. Now I have to a specify the directory that contains my static files. In this case, such directory will be a public. And of course I don't have a public eso they rectory, so I have to create the public's of directory on. I have to clean the up direct week. I have to right click over the root folder and select new folder. And now I have to name this folder ass public on. What I want to do now is to create a CSS file. So I'm going toe select the option new file. I'm going to save this file as my style's. I don't see icis Now. He's safe on going to create styles for my I'm going. I want to create styles for my html code. So I have to create a styles for the hair. One tack on the paragraphs. So I have been here. One attack is that this time would be said toe Well, I'm going to have the property color and I'm going to set this property to blue on again. I'm going toe have a status for power for the perhaps. So I'm going to at the property color and I'm going to set this property to read. Now I go back to my html code or my input dot hs Js file on. What I want to do is to link the style sheet so I'm going to 18. Uh, my stylus, my values docs is now he's safe. Andi in orderto to Ah, in order to make my in order to make my aesthetic web server work, I have toe I stopped the server. You know, the first off the server. I have to press the keys controversy. Now I have to restart the server on. Ah. Now I have to do is to go back to the web browser. Now, as you can see, I am inside the Web browser on what I want to do is tow refresh the page on. Let's see what happens. As you can see must my styles are already working. It's now what I have to do is tow. Uh, continue working with my application. Uh, okay. What I want to do now, if I analyze the if I analyse the HTML Koth, you can see that, um, the form you says the post metals to send the information to the server. So I have to create a road that handles the post metals, or I have to create a road that uses deposed metals. So they've bean up the post on if I go back to the HTML code. You can see that the information off the HTML form is sent toe the address slash display. So I have to go to my server, had to go to my growth on inside my road. I have to type in slash this plate. So this is the way how we this is the way how we can pass the information inside these road . Now again, I have to be in request, then respond bones. And now where I want to do he's toe, uh is to retrieve the information from the is to retrieve information from the from the form. So ah, I'm going to create a variable and they were the first valuable will be set the will The name on its valley will be said toe request dot body dot Now if I go back to my html code, you can see that the name text field or the text field for the name has the attribute name said to user name. So I have to take being the body that Ah you surname. Now I have to create another another variable and this valuable will be gender on its value will be said to request that body request the body dot If I go back to my html code, you can see that the gender text field contains an attribute name. I said to you, sir genders. So I have to be in here. You, sir. Gender. Um I have to create another Another variable. The variable will be h on its value would be set to request that body thought If I go back to my html code, you can see that the age the text field for the age because of the attributes Name said to use her age so they mean Yusor age and finally another have to create another valuable on such valuable will be country on its value will be said toe request the body dot Now if I go back to my HD html code, you can see that the text field for the country contains the attributes name said to you sir country So I have being body dot You sir country now as as you probably you can recall that this is the way how we retrieve information from the, uh from the html form on what he wanted Whether all of this is working so I just went to this. Play some of these barrier I just in order to make sure that everything is working so far, I want to display a message to the console on. I want to display the value off any variable to the council so that I can taste whether everything is working or not. So I'm going to the bean. Ah, variable, Variable name this space name. Now I remember that what I want to do is to test whether my application is working or not. So I'm going to go back to the common parents, have to stop the server by pressing control. See? And now I have to restore the server. I know. As you can see, everything appears to be working. Now I go back to my I have to go back. I have to go back to the HTML based on I'm going to feel in the text fields. Uh, agenda would be female. The cage will be set toe 35. The country will be set to Mexico. Nice President Dong No President don't send information. And now what I want to do is to go back to the council and as you can see. We console this place and you may sash Variable Name Nicole. Natalie? No. Which means my obligation is working on Well, in the next. Listen, I will continue working on these applications. 11. TemplateEngines 10: Well, guys, welcome back to another lesson off this tutorial. Now, in these listen, I will continue working on the application that uses the template engine ages. So as you, as you can recall Ah, um, in my application on this application gets the information from the HTML form and then saves the information or the input from the from the HTML form inside four different valuables. So I'm going to type in a comment storing they came for. He started storing the information from the HTML form. Now what I want to do is to finally use ah, juiced the the templates, the US templates to send information from the server to the browser. So in order to pass information from the server to the browser, one alternative is to use template engines. In this case, the template engines, the template engine that I will just east a year. Yes. So I'm going to remove these these these line of growth and I'm going to create a comment plus seen, uh, information through the template on but I want to do is to create another a J yes file. So I have to go to the abuse soup directory. and I have to write quick the views of directory and select the option new file. Now I have to save these file as a response dot A Yes. Remember, Pay attention to the extension of this file. Remember that the extension of this file is dot a Yes. This is very important. They pay attention today to the extension of the file. Now, I he'd save. And as you can see through a year, yes, Fire has been created. Now I want to handle this file as on Asan html file, and I'm going to ask the markup. So, uh, the title for these template will be this play these play information on, uh what I want to help through toe happen east through what I went through. I want to create a heather. Want that? That contains the fixed. Ah, there's so now information. And, um, now what I want to do, he's toe. Well, basically, what I want to do is tow pass information from these road. So the age, I guess, files. Ok, that's where I want to know what. What I want to do is to pass information from this road from this road toe the A J s template. So in order to do it, I have to type in response to render on. Then I have to specify the template that I went to use in this case. I want to use the Temperley response both a yes, on what I want to do is tow Pass some information. So the so the template. So I'm going to create an object. As you can see on the subject. This this object has a property name. Um, the value of this property will be said toe to the variable name. So in orderto make all of these clear, I'm going toe asked a prefix toe the variables I'm going to at the prefix bar through any toe all the variables like this. Ah, a z You can see I'm adding the prefix bar toe all the variables to make all the growth more easy to understand. And now a size. As I said, I'm going to create a property name on the value of these property will be set to bar name . Okay. So as you can see right now, I'm using the the response file on I'm using the response Thought A s file and I'm passing some some information to the alias file. Now, I'm back in the Indy a year years file and I have toe, uh, I have to create help to ask a very special Syntex, So Ah, but you can see I'm creating a military attack that says that contains name. And I want to check whether, um whether the variable name exist eso in order to check whether the valuable name exist a haplotype being if type of name he's different is the east the first if the type off the variable name is different ah is is is other than undefined. If the type off the variable name is other than on the find, then it means that the variable name exists. So here what we're doing is we're checking whether the variable name exist or not. So what I want to do now is to advise special syntax around this statement. As you can see, this is the special syntax that is used by a J. Yes, and now I have to too little mine. What happens? Give the variable name exists on if the variable name exists, then I want to display the value off the variable name. So um, let's let's try toe. Let's test this application to check whether application is working or not. So I'm going to go to my comments prompt and I'm going to stop the server by pressing control Z. And now I have to start the server on Let's see what happens. As you can see, everything appears to be working. Now I have to go back to my to my list the browser and I'm going to take mean local host 3000 slash input. Now I heat interest and let's see what happens. As you can see, the the the HTML form this place. Now I have to feel in the text fields like this on now. Uh, I have to press the Bhutan same information on Let's see what happens. As you can see, the is your guess. Template this place on as you can see, the information waas once sent from the form toe the template eso. Now you know how to pass information from the from the browser to the server and from the server toe the browsers. Okay, this is very important. You know how to pass information from the browser to the server. Andi, from the server toe the browser. This is very important. How to share Help Pass information from the server and to the service. Okay. Now, um what I want to do is to do after past some properties work. I'm going to remove these aunt instead. What I want to do is to add a new object that is cool profile. Sorry. I want to add a new object on your property that contains an object on these object Week off will contain the property name on the value of the property. Name will be set to bar name on the value of the property. Gender will be set. Tow bar genders on the value of the property bar A notary. The value of the property age would visit to the variable over age On the value of the property were country the property bar so started The value of the property are the value of the property country Sorry will be set Toe country. Now you can see I am sending on object toe the A J s template. So now I have to go to the agency s file and I have to test whether Thea object profile Remember that I have an object profile here. So the first step is to check whether the object profile exist. And if the object profile exist, then I have to display the values toe there. The browser. So, uh, Okay. So what I want to do now is to remove this coat like thes and I just want to toe asked for I just want toe Earth. Four difference. Heather three tax like this on inside the first cut of Retek. I want toe. I went to this play the name they valuable. They want to display their value off the property name. So they pain profile dot name now I have two copies. Coat on. Ah, I want to copy our base. This coat, the second killer to attack will display the gender on display the value of the property gender like peace on again To make it faster. I based the coat the Earth Heaven pretax will display the age eso It has to display the value of the property. Ace on the fourth and last hit a tree that will display the country. Okay, we split the country on. It means it has to display the value of the property country. Now I save the changes. Andi, let's go back to the well. I have to refresh, have to stop the server by pressing the keys controversy. And now I have to restart the servers on. And, uh, as you can see, everything appears to be working. Now what I want to do is to the local host 3000 slash I hit Inter again. I have I want to feel in the text. Feels like thes on. I'm going to prison built in, send information on Let's see what happens. As you can see the template they had the template, this place, the information, all the information that we sent from the HTML form. So now you know how to use template engines, toe pass information from the server. So the browser on as you can see, the temperate engine that we're using right here is a year. Yes, on Ah, well, guys, I think basis it for this lesson. Now, you know what template agents are reduced for? On um Well, in the next listen, I will show you more about Ah, no genius on express 12. Routers 11: welcome, guys. Toe another lesson off this tutorial in this photo in these Listen, I'm gonna show you a way to organize your application. So in other to organize your application, Andi, uh, split your application into several pieces. Uh, you can use something that is known us routers. So in these. Listen, I'm gonna talk to you about routers on in orderto so show you how routers work. I'm going to create a new empty folder in the disk top of my computers on, uh, I'm going to lane These folder us. Uh, fruit eaters exercise now I heat enters. Now you can see a new father has been created. Now what I have to do is go to the common prompt on. I have to 98 to these. A new directory. So I think being change directory This this Stop again. Change directory, rooters. Exercise. I hit. Enter on. Now, As you can see, I am inside the directory that I just created. Now what I want to do is to install the dependencies that I need. No, the first step. Sorry. The first step. Now the first step that I have to take is to create a new configuration file. So I have to created the Packers Jason file in order to create a pack. A Jason vile. I have type bean no package man a year eat. And then he entered and let's see what happens. Well, guys, now, as you can see, no package manager is asking me to provide a package name, so I'm going to say this property toe the fourth value. So I hit. Enter now. Ah, no package manager is asking me to provide a version. So I'm going toe set this property so they typically to the default value. So now I hit. Enter now I have to provide a description. And the description will be very simple. Creating rooters you seen express express your Yes. Now I hit. Enter. Now you have to provide the name off the main file for my application. In this case, the main file will be server thought Yes. Now hit. Enter. He's in there again. And now I have to provide the keywords that describe my application Search Keywords are routers on express. Yes. Now I hit. Enter. I have to provide the outer. In this case, I'm going to provide my name, Which is right, Mondo. Now enter on. Now what? You can see another package manicurist asking me a last question. It is Okay, so I have to say I have been just the heat in dish. Now, if I opens the well, now I have to go to the Coast Writer on. What I want to do is to open the folder that I just created strike up to navigate to the folder that I just created on. Ah, remember that this folder is placed in the disc stuff off my computers. So, um, I said recruiters exercise. And as you can see now, the routers exercise folder he's opened I need contains the Packers Jason file that contains the description off mission. Now, what I have to do is to go to my command. Prompt on what I want to do is to install the dependencies that I need. In this case, I just need toe use, express dependency. So what? I have to be no package manner. Your install Double dash, safe express on. Now I hit. Enter on. Let's see what happens. Know what you can see is being installed in my project on as you can see this process takes a while, so I have to skip this part off the process. OK, guys. Now, as you can see, the expressive pendency is already inside My my my project. Now, if I go to the park adjacent filed, you can see that the reset dependency century that contains the express dependency that I just installed not what I have to do is to create the main folder, the main file for my application. Such fire will be saved. US server DOJ Yes. Now I hit. Enter on. The first step is to include the dependencies that I need. So I'm going to declare a constant express Express on now. I have, like, being require express on, then happily clear, another constant up and its value will be said to express and then parentheses as well. Onda. Now I have to declare the constant, but I have to require the bat dependency. No, um what I have what I want to do now is to create an aesthetic on a static server. Eso I'm going to create another super directory. I'm going to create a subdirectory. So I said, let the option you folder and I'm going to name this directory. As probably now I hit. Enter on that. You can see I have just created and use of them. So they took directory called public. Now I have to go back to the browser Onda. As you can see here, I have four different pictures that I would use for these applications. I have two pictures off cities on the pictures, off animals. So what I want to do now is to save the's pictures inside the the directory public. So I'm going to name this file ass cat, and then he'd save. Now, if I go back to my coffee, I turf. Then see that the public subdirectory contains a picture of the cat. Now I have to repeat this process. I have to repeat these steps for each off the reminding pictures. So I will escape this part of the process on I will come back after I had after I have saved these pictures inside the public's of directory. Well, guys, now, as you can see, I have already saved four pictures for bickering pictures inside the public's of the rectory. So now what I have what I want to do is to create an ecstatic Web server. So I'm going to add a comment. A static whip sever and in order to create is a static Web server. I have typing up the juice Express the ecstatic No, on. Then I have to use the pendant spot on then and want to use the metal. Join on. I have to use the constant with me. And then I have to specify the directory that contains my static files in this case so that such directory is the public super directory. Now, what I want to do is tow, uh, to set up the report that I will use toe toe, establish a connection between the browser and he was servers on. Uh, if everything is working, I want this message will be displayed to the console listening at local Coast 3000. Now he's safe on now. What I want to do is to test whether my aesthetic Web server is working or not. So I have to take being local course 3000 it slash gut the the extension of the file and let's see what happens. As you can see, nothing happens because the the server, uh, the service is December is not working. So re so I have to take me nose servers. Oh, yes. Now I hit. Enter on. Let's see what happens. Well, as you can see that my such the massage displays, which means everything is working. Now I'm going to be in local host. 3000 slash cat. Don't ask the extension of the file. Now I reload the patient. Let's see what happens. Okay, So as you can see, the picture of the cat appears, Which means my ecstatic web server is working now. What I want to do east to, um, is to create on user directory on such so directory will be called Fruits on. But I want to do is to create profiles to JavaScript files inside these routes. Soups of directory. The 1st 5 would be called Ah, honey. Mose. Okay. Yes. Now I hit. Enter on The second file will be called, uh, cities the genius. Now I heat in there. Now you can see my rope. Subdirectory contains toe JavaScript files. And now what I have to do is to declare to Constance the first constant will be, uh, I'm us on is going to save a reference to the animals. JavaScript for javascript file. So I have that. I mean dot it slash Rhodes is lush animals, don't you? Yes. I'm going to create another constants. Cities that is going to a store. Our reverence toe the city's JavaScript JavaScript file. So I think bean about a slash roads slash seti's no genius. Now what I have to do is to create my roads on, uh, in this case, because of the fact that I will be using routers, the roads will be different. So I had to take cleanup produce on then the but the but will be slash any months on, um the and then I have to place the reference to the animals. You have a script file and I have to repeat the process. I have to create the road. The others will be a slash cities on. I'm going to place the the constant cities. So, uh, what happens here is that if the user be open city with browser on B C, it's the address local host 3000 slash animals, then, um, the big ever script file animals, don't you? Yes, will be used. So if the user types If the user visits the address, look a host 3000 slash cities. Then three Yusor will be read. Directive toe the city's JavaScript file. So, um again, if they the user be opens the Web browser and visits the address local host 3000 slash animals, then such user will be taken. So the animals the genius dot Java's toe the animals told Js file. And if the user visits the address local host 2000 slash cities, then the user will be taken to the to the JavaScript file cities dot Js So now, in the in the next video into this lesson, I will continue working with these routers. 13. Routers 12: Okay, guys, welcome to another lesson of this tutorial in this lesson, I will continue working on the application that contains route routers. So and now what I What I want to do is to get over to the file animals, don't you? Yes. Which is my first router. Andre Will Routers can be described us small applications. So routers contained dependencies as well. So I'm going to create a comment. Dependencies on the first dependency that I need peace, the express dependency. So I declare the constant express on night. 18 require express No, what I need, he said Constand called router on its value will be said Toe Express. Don't Rubisch now what I need to the clearly constant but and its value will be said toe require. But now this These are all the dependencies that I need for the router. So what I want to do now is to create my first road. So they deny create a comments, roads, and in order to create a route or wrote inside a routers, I have to take being root there dot get, and then I have to specify the address in this case, the address that I want to use his cap. And now I have to create on a reflection. Remember that the ad Rovira function requires two parameters. 20 trip when his request on the other east response. Now what? I need east to send on html uh, file as a response to the browser. Sweet bean response. The same file on now inside the same file metals. I have to specify the path toe the HTML file that I want to send to the browser. So in order to specify the path to the HTML file, I have to use the fat dependency, the joint metals. I don't know. I have to specify the your name. Constant. In this case, the your name Constant. It stores the path to their roots. Subdirectory. This is very important. In this case, the your name Constant. It stores the bat so their roots soup directory. Okay, this is very important. Now I have toe specify the but to the so the html file off course. Such html file does not exist yet, but I will create it later. So I have to take being double dot, slash and then ah, abuse. Oh, sorry. On then, a slash God thought html off course. Remember that thes file does not exist yet. I will create it in a moment. Now I have to take being or do those exports equals router on. This is seat. I have just created my first router on. Now what I need is to create a subdirectory called abuse like these. And now I have toe I have to create on html file inside these views of directory. So I select the option you file on the name of this file will be got the html now heat Inter. I know what I want to do is to create a very basic markup. So the title will be set toe cat people the I want to add a further one time that contains got as well. Andi, I want to display this. Play the picture off the gut in this in this, um, in these html file. So what I want to do is tow to specify the path. So the cat picture in this case, I'm going toe typing slash. This is very important. You have to type in a slash in order to another For this picture to work, you have to be in it slash and then got on, then the extension of the file. And now, as you can see, I got my first route as a swill as the HTML file that will be displaced to the browser. Now what I want to do is to create a second router. So what I want to do now is to copy this cold, and I'm going to open the file City Stop, J. Yes, I'm going to base the cold here, but I just want to make some very small modifications. So the battle would be a slash Mexico City on the HTML file that will be sent to the browser will be Mexico citi dot html. Now what I want where I have to do is to create the file Mexico city dot html. So I have to get over to the abuse subdirectory, and I have to create a new file inside abuse subdirectory. I'm going to name this file US Mexico city dot html and now hit. Enter on. What I want to do now is to create a very simple markup. So the title will be Mexico City on. I want to us a better one. test that says Mexico City Sorry, Mexico City. And now I want to display the picture off Mexico City. So I have to specify the path to the picture. So the first step is to type in slash and then the name of the file that I want to display the name of the picture, that it went to his play in this case, a picture that I want This play is Mexico City. That extension of the file. Now he's safe on. As you can see, I have two routers the animals router, the city's router aunt three html files that will be sent as a response to the browsers. Now I'm going toe to explain how how all of these works, Um, well, basically, when the user BC, it's the address local host 3000 slash animals Such user will be sent or will be taken to the animals. The Js file again when the when the user visits the address, local host 3000 slash animals. The user will be redirected or will be taken to tow the animals. Julius file on the animals. Don't JDS Triaud contains our route, which is is ah slash cat so if the user visits the address. Local Khowst 3000 slash animals is slash cat then, uh, the UN HTML file will be sent back as a response on such HTML file contains the picture off a cat off the gut. So that's what happens again if the user visits the address. Local host 3000 slash cities then the user is sent for is taken to the cities that Js file on the city's got Js. File contains one route on the route East Slash Mexico City. So if the user be seats, the address local host 3000 slash cities slash Mexico City, then on HTML file will be sent back as a response on such html file contains the picture of Mexico City. So thesis away toe how you can organize your your application. Now what I want to do is to stop the server on. What I want to do is to restart the server. So I think the note server doj Yes, I hit enter and as you can see, everything appears to be working. Now I have to go to the to the browser and type in local coast. 3000 slash Ah, any month his slash cat on Let's see what happens as you can see the picture of the cat, this place. So if I take being a local course, tricked out sand slash cities. This slash Mexico City and now I hit. Enter. Let's see what happens. The picture off Mexico City is displayed to the browser. So, as you can see s so far my application is working and will, uh, in the next lesson, I will continue working on these application that contains routers. 14. Routers 13: Welcome back to another lesson of this tutorial. Well, in this lesson, I will continue working on the application that contains routers. So what I want to do is to, uh what I want to do is to create another. Another route for the animal stole Js file. So, uh, as you can see, I am inside the animals dot Js file. So I have to type mean in order to create another route. I have to take root there that get on, then they But in this case, apart will be horses on. Well, basically, what I want to do is tow Copy the growth. Ah, both. And now I have to baste it like this. Now I'm going toe change the but two courses on Now I have to change the h the html file too. Mm. Of course, this as well. On. Now, where I want to do is to open these cities dot Js file and I want to create another route. So I'm going to copy the code. I'm going to paste it below like this. No, I want to change the bath toe. New York on I want to change the html file to Ah, New York thought html file html. Now what I have to do is to create. Ah, What I want to do is tow Make a copy off these html file In order to make a copy, I'm going to select the option. Save us on. Ah, I'm going to say they could be as new. You're got html now I heat safe. How much you can see a new HTML file has beena beef to the abuse of directory. So now I have to change the title toe New York. And now I have to change the hither one tax to, uh, New York as well on. Now I have to change the picture. Referenced toe New York City, New York City. Okay, now what I have to do is to open the fire cat dot html on I want to make I have to make a copy off these vile. So I select the option. Save us. I'm going to name them. I have to name this copy. US forces. Look html No, I hit the enter, and as you can see, I have a copy of the file. Now what I want to do is to change the is to change the cycle. The hitter won Tak Tau horses on. I have to change the referenced the picture toe. Uh, of course this as well. Now what you can see, I guess. Ah, I have to To new routes. One routes, one route contains the addresses courses the other route contains the other s New York on I have toe do new toe two html files that have that have bean a veto. My project one file is New York on the other file East courses that HTML Now what I want to do he's tourist artist is to a stop the servers. So I have to present keys, controversy And now I have to start the service. So I think be note several Doctor Doctor. Yes, I hit enter. And as you can see, everything appears to be working. So I have to go to my browser and I have to take bean cities local host 3000 slash cities slash Ah, New York hit. Enter on As you can see the picture off New York he's displayed. Now if I they bean local host 3000 slash ah, animals slash forces and then he enter Let's see what happens. The picture of the horses is this place to the browser. Now, what I want to do east to, uh, is to create, uh Well, I have to go. Have I? What? I want to close some files. Like thes on. Now. I am in the server dot Js file. Now, Uh, what I want to do is to this grave what happens? Okay, What I want to do now east to this crime, what happens when the user busy? It's a webpage on such web page does not exist. So in order to describe what happens when the user visits even a visit given address, Andi, such address does not exist. Or, in other words, what happens when the user busy it's given with page on the Web page does not exist. I have to determine. I have to describe what happens in such circumstances. So I kept with a bean up. Those get and I have to to create a generic a generic path by using asked the risk. And then I have to create an arrow function and then requests on response. And then what? I want to happen east to send a response to the browser. Uh, like peace. I want I want to send a response. A response to the browser that contains a other one back on the message that will be sent back to the browser. He's a row 400. And for error, 404. The base Wes, not phone. So now I I save the changes on, uh in order to test whether all of this is working or not. I want to stop. Must my server by pressing the keys Contra C and then I have to restart the server on now What I want to do ease today being a local Khowst 3000 slash, um is large. Mm, My profile. My profile. Let's see, uh let's hit. Enter on that. You can see the error message This place ever 400 for the page was not found. So if I take being that I think that the local host 3000 is lash Tokyo, for instance, don't you hit Enter. Let's see what happens again. Error 400 for the page was not found. But what happens if I don't mean a local host? 3000 is slash animals. It slash Ah, I don't know it slash though, for instance. Let's see what happens. Okay, as you can see, Sorry. Sorry. I have the typing. Local host 3000 slash animals with s it slash, though now I hit Enter. But as you can see through the error message, is this place today to the browser? So, uh, you can see So now, as you can see my application since he might, my application is able to send. I never miss Ash Eve. The Web page is not available, so I think this is it for these application. Now you know how to organize your obligation Helpless pleated your application into a smaller pieces on such pieces are known as croupiers. Well, guys, in the next listen, I will show you more about no Js and express. 15. MiddlewareIntroduction 14: welcome guys to another lesson of this tutorial. In this lesson, I will show you more about no judges and express well in these. Listen, I will start talking about what is known as middleware or middleware function functions. So in order to understand middleware functions, um, we can say that I can say that Miller functions are a set off functions that are cold when after the olders. So again, middleware functions are a set off functions that are cold one after the others. So in order to understand middleware functions, I think the best approach is to start creating some very basic applications. So, um, what I want to do now is to create a new project. So I'm going to create an empty folder inside the least risk top off my computers. And I'm gonna called these folder as middle where Meet a where middle where ah meeting will meet. It would one. Now I heat ender. But as you can see, I've just created a new folder called Middle Were One. Now I have to navigate to such a directory. So I have to type means change directory double dog slash. Now what? You can see I am in the desktop and now I want that I haven't I being change Directory. Meet a where one No heat. Enter on. As you can see, I am inside the directory. Middle were one. Now what I want to do is to create the configuration file for this is this application. So I have to type in no package man a year in it. And now heat interest and let's see what happens. As you can see, no package man a year is asking me to provide the backlash name in this case. I want to set thes city. I want to set these option toe the fourth value. So I heat enter now. I have to provide diversion. I want to use the default value. So I hit. Enter now Have to provide a description for this application. So I'm going to type in middleware middle Middle Where? Sorry Meet a where? Ah meeting were up. Now I heat enter now. What I have to do is to provide the entry point. The entry point is the main file inside my application. In this case, the main file is Surber Dog. Yes. Now he enters Hit Enter again hit Inter one more time. Now I have to provide keywords that describe my application. In this case, such keywords will will be meal. Where on express I hit. Enter now I have to provide the outer. In this case will be my name, which is right window hit. Enter Enter again on now. No package. Manager Lisa is asking me a question. Is this OK? I think he just hit Enter again. And now, as you can see, I just finished creating my, uh, my configuration file. Now I have to open the the code writer on. I have to navigate toe the directory that I just created. As you know it. The directory is inside the stop. I select the direct directory middleware on open the directory. Now, as you can see, a new window appears on. You can see that my backer, Jason file contains the settings that I provide it. So the comments prompt as now what I would want to have to do is to install the dependencies that I need. In this case, I just need one dependency. So if there be no package money here in style, nobleness, double dash, safe express now I could enter on. Let's see what happens now, As you can see expresses being installed inside my project on Well, this process takes a while, so I have to skip this part off the process. Well, guys, now you can see the expressive pendant speakers already being installed inside my project. Now, if I go back to my back a Jason file, you can see that the express, um dependency appears inside the file. So this is it, Theis Express. They dependency is already inside my my project. Now what I want to do is to create the most the several Js file. So I have to say this new file us servers. Okay. Yes, I hit enter. And now what I have to do is to declare the dependencies the Ben then sees. So I declare the Constand Express. Andi, I have to require express not have to declare another constantly constant up on. I'm going toe, uh, around the function express on now. Uh, well, I think this is it. This is sold that I need Yes, I think this is it. This is all that I need. So now what I want to do is tow us meet over functions me needlework functions on. As I said earlier, a middle were functions are functions that are called one after the olders. So, um let's create the first middle middle were function that I want to use in this case another In order to create a middleware function I have typing up the use on. Then I thought toe I have to provide I have toe create an arrow function on now what I have to do east to toe provide three parameters. The first parameter will be request. The second parameter will be response on the third parameter would be next. Now what I want to do in this case is to create a new variable. So I want to create a variable that is a high level took out the middle were functions. So in order to create a variable that is a high level took out, they meet it with throughout the middle where functions I have to type in response, I thought locals that the name off the variable So in this case, I want the variable to be bar one. Now the value of this parable will be said toe. I either want that on that contains fellow world. Now what I have to do is tow to use a metaphor for a function that is known as next on these thes function. What What this function does is that the next function for the next metals past, the control toe to toe the next middle were function again. The next function bus passes the control. So the next middleware function. So I have to create another another meeting or function after looked youth and again on a narrow function on, uh, three parameters request response that next on now what I want to do is to create a new variable. This variable will be the response thought Locals dote and bars part two on. Now, uh, the value off this variable will be will be said toe. Um So the value off the first variable in this case responds that locals those bar one. But I'm going toe asked a new value, uh, or or, in other words, I'm going toe act on a strange on such a strength will be a paragraph as, uh, I want to add the us the text first. Badda grab. Now what? I want to do is to call the function next. Remember that the function next passes the control. So the next meter were function. Uh, so again I have to add another meter were function. So I'm going to copy these this growth on going to paste it like this. And now I'm going to add a new variable. This new variable will be bar tree, as you can see. And now the value off the variable tree will depend on the variable too. On I'm going to have a new paragraph in this case, this paragraph will be second paragraph, second paragraph. Now, finally, I want to set my roads. So I think being wrote on I want to sit a rope eso without being up thought get And then the path would be there. The main well, the but will be. Hello, Andi. Then I have to create the arrow function on Then the up the properties requests the parameters request on response. And now what I want to do is to send a response to the browser. So I take in response that send on In this case, the response will be the text that is a start in the variable response taught. Locals don't ah, bar pre bands. And now what I want to do is to at another butter. But I have to ask another parameter which is next on, uh, you can see the response off these route the the response off these road with the the value off the variable response those locals thought Bar three. Now what I have to do is tow to set up the port. So I think being up dot Ah, listen on, then. 3000 are a function on the same lines of growth console. Don't low. Uh, Lisa mean at look at hosts 3000. Now what I have to do is to run my application. So I go to the common prompt on the bean. No server doctor. Yes. Hit. Enter and let's see what happens. OK, guys. Now, as you can see, everything appears to be working. So I have to go to the to the rouser and I'm going to take being local host 3000 slash Hello. Now I hit Enter and let's see what happens. As you can see, I thought, uh, 11 hitters on the first paragraph as well as the second paragraph, which means that my middle where functions are working on as you can see the middle were functions our asset off functions that are called one after the other. Andi, he's away toe to organize our calls. We can I split our coat into several pieces on uh then, uh, those solutions can be cold one after the other. Well, guys, I hope these at least first listen. Has I hope I will in the next lessons, I will continue. I will continue talking about middleware functions. 16. MiddlewareRoutes 15: welcome guys to another lesson off this tutorial. Well, in this lesson, I will continue working with middle work. But in this lesson, I'm going to show you how you can configure meter were functions for a specific routes. So in order to configure your middleware functions for specific roads, you have tow Well, let's let's see how you can configure middleware functions for specific roads. So what I want to do now, as you can see well, as you can see, what I want but I want to do now is to remove my coat from the previous listen. And, uh, what I want to do now is to create roads and in order to create roads, I'm going to taping up. Get on the first road would be a slash The first road contains the bath. It slash animals on, uh, three second road contains the bat. It slash cities. Now, what I want to do is to create my first I want to create Ah, okay. I have to create my first arrow function. So these are all functions requires three parameters thes from Shoney's Before I start, it's important to say that this function is a middleware function. So I'm going to provide three parameters request response. And, uh, next Now what I want to do is to ask another Another middle were function for these road route. So I have to type in a coma and then another a revolution. Now, this are a function requires three parameters requests. Response. Next. And now I want to us one more meter were function, so I have to create an arrow function on. I have to provide three parameters for the quest response. Next on the first middle were function. He's going to create a local variable, so I have to type in response. Mm dot uh, look as dote. Ah, hither one or h one on what I want to say in these variable ease, Heather, want that on the head? One time with will contain the text, Animas. Now what I want to do is to pass the control toe the next the next middleware function. So I have to take things The next function now in the next middle were function what I want to do. East Teoh do us and mother, uh at what? I put a grip. So I want to be a hepatitis bean response. The locals the ah, one on what I want to do is to attach the value over the off the variable response. Does Locals, though, hated one toe to these new variable. So, uh, I have to say that when I want to do is to at some fixed do these new variable on this new variable is a combination off the first variable on a new strain off Kharkov off text. So the string off takes that I want toe. He's a proverb that says, Ah got Well, it's ahead of three together. Three tax. Sorry. Sorry. Uh, I'm going to change the name of the variable to hit a tree, and, um, not enough. Sorry. Sorry. I will. I'm gonna keep piling up. One Sorry on this program will contain the takes cat. Now, what I want to do is to pass a control to the next middle function on and on. And now what I want to do east toe to create another variable in this case available will be response. Those locus those paragraphs two on, uh, this new variable. The value of these variable will be a combination off the both variable on a new string off text, so they'd be in response. Does look a that Ah, But when? And I have to add another piece of text in this case, I want to ask and you partner up on the part of Europe says, Ah, I don't know courses, for instance. And now what I want to do is to send these, uh, to send a response to the browser so that they'd be in responds the same on I want to say as a response to the browser the value of the variable response dot Look, guys, that character. So now, in order to where? In order to check, I'm goingto deleted these roads in order to check whether my cove is working or not. I want to go to the comments prompt and I want to stop my server. So I have to type mean I have to press the case contro see to stop the server. And now I have to restart the server. I know as you can see, everything appears to be working. So now what I have to do is to type in local host slash look and post 2000 slashed animals Let's see what happens. Local host 3000. It's slush on Mel's now heat interest. And as you can see, I said, Ah, they hither one pack animals followed by two paragraphs. So, as you can see, you can configure. Uh, you can complete your middle were functions four specific roads. Ah, Now what I want to do is tow. Repeat this process one more time. So, um, what I want to do is to copy this cold like these on. I just have toe based it. And I just went toe would make to make some changes to this growth instead of any months, I'm going to be in cities on the first valuable hitter. One will contain cities instead of animals. On the first paragraph will say New York, you're on three. Second paragraph will say, uh, doctor. Okay, uh, on just this is it. I think my cooperation My I I think this is it for this application. Yes, I have CTC, New York, Tokyo. And now what I want to do is to stop the cerebral right pressing controversy. I'm just out of this ed rush now. Everything appears to be working Now. If I type in local hostess Lashed fifties Let's see what happens. As you can see now I have a feather one time with the text Cities followed by two paragraphs. One is New York and the other paragraph says Talk you So now as you can as you know as you can see middle world functions again. The, uh, configured four specific roads Ondas You can see middleware allows you toe. Maybe there were functions. Allows you enabled you to explain your coat into several sections s so that you can organize your coat. Onda meter were functions enabled you toe to a split your coat into several functions and then you can Ah, you can deter mine. The order in which those functions are called. Well, guys, I think well, in the next Listen, I will continue. Ah, I would continue speaking. I will continue speaking about, uh, meter were functions 17. MiddlewareRouter 16: Okay, guys, welcome back, toe. Another lesson of this tutorial in this lesson. I will continue working. We'd, uh, middleware functions. Me. There were functions. Now, what I want to show you is how to use media were functions alone. Wheat alone, wheat routers. So what I want to do now East toe elite, This growth the coast that we created in the previous lesson. And, um, what I want to do now is to create routers. So in order to create a router, I want to create a new suit directory that is called roads on. Um, what I want to do now east to to create is to create a new constant. Ah, And then and then the name of the constant will be animals. And then these constant, uh, well, a store, a reverence toe are brutish. So, uh, I have to being dot slash roads. It's slash animals. Both genius. Now you can see these things constant. A stores are reference toe the javascript to the animals. Thought Js file. Now I have to go to the roads. So directory and I have to create a file called I have to create a file. Andi thinks file will be called, uh, Animas Any man's thought? Yes. Now you can see I've just created my the animals dot Js file that will contain my router. So now what I have to do east to the clear Constant Express and its value will be set to require express. Now I have to create a constant Rueter and its value will be set to express. I don't Rubisch no, um, but I want to do east to, uh okay, I have to go back to my animals stuff j I have to go back to my several George alias file, and I want to, uh, set up and my my routers. So I think being a comment set up routers. So I have to use apple juice on. I have to think through toe specified it. Pat for this router, in this case, apart will be animals on. I have to specify the constant animals. Remember that the Constant animals stores a reference to the animal stop genius file on. Um Okay. Now what I have to do is to go to my router. Gonna have to create, uh, I have to type in module. Those exports. Exports equals Ah, rooted. Now what I want to do is to ath set off middle functions. So what do they mean? A comment? A comment? Middle were functions. So read me. They were functions. And now what I want to do is to add a routers. The excuse. Ah. And now what I want to do is tow half an arrow function on, uh, the arrow function. We contained three parameters. Request thought, requests response. Serie Coma on next. No. Ah, in my first in my first middle or function, what I want to do is to the clear a variable. So I think in response to the locals, don't. Ah, care one. And I want to create a favor one like these on, uh, the value off these heather. One tax will be animals. And now what I want to do is tow create to call the function. Next. Remember that this function passes a control. So the next middleware function now I have to do is to being routers that use a meter work . I have to create a narrow function. I have to, uh oh. At three parameters. Three parameters. Request response on Next on what I want to do is to create a variable, so they'd be in response towards locals. I don't have one on, uh, what I want to do is tow one paragraph on the paragraph will contain the text. Um, forces, for instance, on Guy wants toe. I want I want that the value of these very devalue off this variable. Um, it's a combination off the previous well off the previous variable. Andi thesis strength off text. So I have to have a cookie. A reference. I have to copy the reference to the previews. Variable on. I'm going to paste such reference like this. I'm going toe attach the text like this. So, uh, now what I want to do is to, uh, to call the function next that passes the control to the next meeting or function on. Now I have to want to copy these goals on. I want to baste it on. What I want to do is to create a new variable caused paragraph two on the value of this valuable will be equal toe the value off the off the valuable A paragraph when close on your string off text on the newest wreak a strange off text contains, uh, the next, um Ni docks, for instance dogs, those and guts for business. Now what I want to do is tow. Define a road. So I have to be in roads. Andi, I'm going to defend a road us road there don't get the but will be listing angop toe the arrow function on as well. I have two or three parameters. So I copied these three parameters on I want based these parameters right here on, um, these root root we'll send a response to the browser. On the response will be the value off the variable response locals dog. But I have to. So I copied a reference to the variable on I paste paste it like this. Now, of course, as you know it, these are router on. Uh, what I want to do is to test whether all of this is working or not. So I have to go to my command. Prompt. I have to stop the server by pressing the keys control. See? And now I have to start the server and let's see what happens. But you can see everything appears to be working. So now I have to go toe to the browser and I have type. Mean local host Street 1000 slash. Uh, animals. It slash uh listing. Hit. Enter a Let's see what happens. As you can see, a new ah new with page appears that contains animals for loath that contains the heather one The Hitler animals followed by two paragraphs. The first paragraphs. The first paragraph contains horses on the second. PowerUP contains dogs and cats. So now you know how to use meter Were functions, middleware functions inside rooters. So, uh, now in the in the next listen, I will. In the next lesson, I will continue working on these application t to show you more about about middleware functions. 18. MiddlewareRouter 17: welcome guys to another lesson off this tutorial. Well, in this lesson, I will continue working on the on the previews application. So, uh, in this lesson, I will show you how another another way, how you can configure your middleware functions. Um, I'm going to show you another way how you can use me. There were functions inside rotors. So in this case, I'm going to show you how you can, um, configure meter middleware functions for a specific, uh, roads on. Now, what I want to do is to the elite the growth off the off the road, off the routers. So, uh, now you can see this is the coat off the router on. As you can see, I am inside the file animals thought JDS Now what I want to do is to create a road. So I have to take in a comment roads, and, um, the first I'm going to create a road for these routers. So I think being route there don't get And now, like upto the fat for these routers and in this case, apart for the road will be a slash listing on. What I want to do now is to add a narrow function on these are a fusion will contain the parameter request. Chris points on next. Now, uh, where you want to do east toe after another are a function on again. I have to ask three parameters. Requests. Response on next. And finally I want to ask one more IRA fusion. Andi, I have being requests. Don't comma, responds Goma next. Now, uh, what I want to do is to ask at variable inside these wrote. So after they being responds, the locals both hated one on the's will contain either one task like these on the here was that one that will contain text. Anyone's this thing Now I have to call the function next. Remember that these function passes the control toe. The next middle were function. Now what I want to do is to create another variable. So it will be in response. The locals don't, uh, telegraph. When on the value off these valuable will be set toe response boat locals dot Either one blows. Ah, another, uh, a stranger off text. So the string off fixed. We contain a paragraph like thes on on the program. We contain the text cuts on docks, for instance, Onda again, I have to use the function. Next that passes the control to the next middle were function. And now what I want to do East to create one more paragraph. So I have two copies. Cold as I want to do is to pace the coat right here in the next middle or function. And now I have to name this parable ass direct to on the take. The value off this valuable will be equal to the value off the variable. But when blows I knew a strange off text that contains courses on, uh, Lions. So and now what I want to do is to send a response to the browsers what they'd be in response to the sand Onda. The response to the browser will be the value off the variable response. The locals, I don't have to. Now what I have to do is to go to my go to the Web browser on by being local Khowst 3000 slash animals slash ah listing on. Let's see what happens so well before that I have to go to the common prompt. I have to stop the servers by pressing the keys controversy. And now I have to sort of start the servers on. Uh, let's see what happens. Okay, Okay, as you can see, uh, the moustache listening at lookout at local Khowst 3000. This place, which means everything is working. So now I have to take being local host street thousands slash animals, it slash listing, keep enters. And as you can see, uh, defend the other one that pierced animals listing followed by two paragraphs. The first paragraph says cats and ducks on the second paragraph says courses and lions. So this is another way off using, uh, neither were meter were functions Onda. And this is another example on how you can use middleware foods, middleware functions alone, wheat routers. So, uh, in the next listen, I will, um I will show you more about middleware functions. 19. MiddlewareForm 18: welcome guys to another lesson off this tutorial in this lesson off this tutorial, I will continue working with Middle where middleware functions. So, uh, as you can, as you can see, thesis, My, this is the application that I created in the previous lessons. Ah, but now, in this case, what I want to do is to install another dependency for these application. So I have to go to the common problem. Comments prompt. And I have to stop the server by pressing the keys controversy. Now what I want to do is to install an over dependency so that they be note puckish man a year and stop double dash shave on, uh, the dependency that I want to install. East? Yes, on. I also want to study the bend and see body parts. So now heat center and let's see what happens. Well, now you can see the dependencies are already installed inside my project. So if I go back to my back and Jason vile, you can see that dependencies body parts are on a year. Years appear appears listed here. Now what I want to do is go to my server Doctor. Yes, File on and I wants toe at a constant body Parts on. I want toast. Set the value off piece a constant toe require. Oh, the boxfish. Now what I want to do is to configurable the part, sir. So I have to add a comments going to see your holy Parsons on the analytical Viewable Depart, Sir, I have to typing up juice and bully purser Those u r r l in Coolidge's go this extended force. Now I have to use another middle work pollution. So they bean ab use bully purser that Jason. Now what I want to do is to confuse you The View view Engy, the temperate engine. Then Blake changing. So you know, in other to configure the temperate Angie, I have to take being up that set abuse on. Now it's up to specify the folder that contains will contain my HTML coz Now I have to specify the directory that will contain my HTML code in this case that the directory will be dot slash abuse I have to specify the view engine very one to use on the u engine ease. Yes. So now what I have to do is to add a subdirectory called the use on they want to create Ah NH conned on a year? Yes, File. So I have to take mean I have to select the option you file. I'm going to, uh, to name this file ass form both a year. Yes. Now I want toe handle these file as HTML so I have to create a by a basic HTML markup. The title for these file will be personal information on uh I'm going to other Heather went back That says personal information as well. What I want to now east to create form, Onda had to specify the might. Both will be boast on the action Attribute will be set toe include now what I want to do ease toe. As for our reps like piece Okay, you have to add four paragraphs. Okay, One more part Rab. Okay, The first part of grandpa uh, contains the name. I have two other text field on the name of these they attribute name for these text field will be is her name. Now what I want to do is to copy this coat and I'm going to baste it right here. But I'm going to replace the name attributes to you, sir Yin Dish and I'm going to replace name with gender Now I have toe copy this code again . Happily bean age on the name as a good will be set to user age Now I have toe based again the same Goethe ongoing type B phone tree on the attribute name When he said to you serve country Finally what I have to do is to ask a Bhutan So the the type it would be Smit on the value of this book tone would be the Wallabies Bhutto off the value will be say said to sent information Okay, Now I have to go to my to my several Js file and I'm going to change the routers they pat for the router So ah, maybe profile Okay on I'm going to change Uh huh. I'm going to change the Constand animals with the constant profile on going toe Scroll up the this file on I'm going to change the constant animals We did Constand profile as well on these constant profile will contain reference toe JavaScript file called a profile doctor Yes. Okay, so now I have to go to my roads I have changed the name off this file. Remember that the name of this file is animals. Those jail. Yes, but I want to change this file Toe profile. Dog J Yes. I have to select the option rename. What did they being profiled? Genius. Okay, so now Ah, Okay. I have my new routers ons. I wants to the lead. I want to the lead these roads. Yes or not. Okay. I want to delete these roads. I'm not going to create and other roads. So in this case, and your road will be a rope there dot Don't get on uh, the but for this road with the ah up on book on then I'm going to create on a revolution on the IRA function we contain. Request that response Onda and we go vein. Okay. So far, it week of dangerous request and response on what I want to do is to send a response to the browser that say's response. So I think bean response don't renders on. What I want to do is to send the, uh the template form, don't you? Yes. So they bean form those a year? Yes, on De So if the user to the user visits the address it slash profile local host Rick House and his last profile. Ah, it slash in book. Uh, the HTML form will be displays. So the browser. So I have to test whether all of this is working or not. So I have to go back to the common prompt, and I'm going to start my service. But they'd be no server dog. Yes. Second Inter. And let's see what happens. As you can see, everything appears to be working. So now what I have to do is that they be local host 3000. His last profile is lashed in books. Okay, look, a whole street 1000. His last profile. It slash in boot. Now heat in fish. And as you can see, the HTML form this place, which means my application is work. My application is working so far. So now what I have to do is to go to my ages to my form. I thought a year years file and what I went to the O is to change the action Attribute. I want to set the action attribute to, uh mm. Profile is slash his last profile. It slashed in. Good. Okay, So the action attribute is now said cu slash profile is lashing boot. And now I have to make a root effort for such for such address. So helped 18 route there that closed. Remember that this is important on the HTML form, you says the post metals to send information to the server. So I have to. So they bean router that post This is very important. And now I have to being input as well. But what I want to do now is just toe the request on the response parameters on, um I want to send a response to the browser that says a moustache. I want to send a message to the rouser if they if they formed. If the form Okay, after you feel in the next fields, you press a button, send information and then the information or the input from the HTML form he's passed through these router. So these road and then these road will send back a message to the browser on the moustache . Would say, uh, pain so rethinks. Thanks for sending same book. Thanks for sending the book. Now I want to test whether all of this is working, so I have to go back now. As I said, I want to test whether my implication is working. So you stop the server. I ever started server again. Well, it seems like everything is working, so I have toe goto my obligation on. I'm going to feel in the fields, the text fields and I'm going to spread the Bhutan, send information, and let's see what happens. Okay? It appears like something is not working. So what I have to do is to, uh well, but I have to do is to refresh the was based. Okay? I refresh their with Paige. And now I have to feel in the text fields and again I have to President don't send information. And as you can see, uh, this moustache appears. Thanks for sending sending the input. So it appears like my application is working on now. In the next lesson, I will continue working on this application 20. MiddlewareFormInput 19: welcome guys to another lesson of this tutorial. Well, in this lesson, I will continue working on the application Onda will atyou can see. This application contains a form Onda. We are sending the information, uh that we're sending the information off this form today to the route that contains the path slash input. Now what I want to do is toe get the information from the from the html form on save the information inside different inside different variables. So what I have to do now is to well, I want to change to improve my iro function. I want to add a parameters next to these arrow function on now what I was is to remove these line of growth And now what I want to do is to create a variable called name Andi. I want the value of these variable will be set to request dot Ah body dot On now we have to go back to the to the HTML code. On that you can see the text field for the name contains the attribute name said to use her name. So I have to use and the body that use her name. Now I have to create another variable In this case, the valuable will be gender on Going to set the value off these variable to request the body dot Now I have to go back toe the I have to go back to the HTML code On that you can see the gender html The text field for the gender contains a attribute name on the value of the attribute Attribute Name is equal to you, sir Gender. So I have to use yusor gender Now I have to create another variable In this case, it variable will be set. Will be, uh h on its value will be set to request that body that now I have to go back to the HTML files on As you can see, the text field for the age contains the attribute name on the value of the attribute name is equal to user age. So I have to use the body that yusor Asia not after I have to create another variable. In this case, a valuable will be country on its value will be set to request that body that I have to go back to my html coat and as you can see the text field for the country contains the attribute name said to user country So I think being taught yusor country Now you can see the values off the H the information provided by the i th demon form he's already saved inside four different variables. Well, what I want to do now is to improve my variables a little bit so that my valuables so that these variables are a bi level took out, took out a loan. The took out the media were functions again. I have to improve these variables so that the values off these variables are high level took out the middle were functions. So instead off, uh, piping in instead of using instead off using Let name. I want to replace these with requests. So the response dot Look, ice don't name. So I have to remove let gender and I have to replace these with it. Response the look guys dot um, genders on. I have to remove Let age on replace these weak response dot locus. So genders on again. I have to remove this country. And, um, I have to replace these with a response dot locus doc gender Now the values will be available drug out my middle or functions. Now what I want to do is tow passed control to the next media were function, so I used the next metals or the next function. Now I have to create another IRA function. These are a function will be my next middleware function. So it has to contain three parameters. Request response on Next on. What I want to do in this middle were function east toe, uh, display some values, toe the to the console so that I can make sure that my application is working again. What I want to do now is to test whether my obligation is working or not. So in order to test whether my application is working or not, so far, what I want to do is to display the values, uh, of the Soviets html form inside. The comments prompt. So what I want to do is to take me in council. Look, And then I had a bean. Ah, response. Locus name? Andi. I want to repeat this code three more times, so I copied his coat. I'm going to paste it, Uh, one more time like this. I don't want to change name with gender. I'm going to change. Ah, sorry. Sorry. I have to have to come back to my initial variables on instead of using gender in all the valuables, I have to use locals that age. Sorry and locus thought country. Sorry I made and I made a mistake in the previous valuables. Okay, Now again, I am I am in the inside. I am in the console. Love statements on I want to I want to display to the console response stopped. Lookers thought age on response to a local start country. So this is only for testing whether my application is working or not. So and so in order to test whether my application is working or not, I have to go back to the council. I have to stop the server by pressing the keys controversy on. I have to restart the servers with no server togs. He enters on As you can see, everything appears to be working. No, I have toe Come back to the to the HTML form and I have to feel in the text fields on now. What I want to do is to press the button send information and let's see what happens. No, if I, uh if I open the comments prompt, you can see that the values used to feel in the text fields appear in the common prompt. As you can see, the common prompt. Now the value Nicola Tallinn appears as well as female 55 on Mexico. It means that s so far my application is working. So my coach is working. So remember that when you are working with an application and where do you when you are creating application, it is important that you test whether you whether your application is working or not. Andi, best alternative to test where your whether your application is working or not is to use the command prompt like this in order to test if everything is working. So as you can see the values Nikon, Italy no female 35 Mexico appear in the comment. Command prompt. Which means so far everything is working. So now what I want to do is to come back to my application. And now what I want to do is tow Remove these, uh, used to remove the council. Look statements on Now what I want to do east toe. Um okay. I want to create another view. So I have to get head over to the views of directory on. I want to create another you. So I right click over the abuse subdirectory on. I select the option you file now I have to save this file us. Ah, as response dot A year? Yes. At risk phones. Both a year. Yes. Now I heat safe as now. What I want to do is to create a very basic HTM of markup. Okay, on. Now I want to type in the title. In this case, the title will be, uh, thanks for your information. Thanks for sending your information in for mation on. Now. What I want to do is to add a header. Uh, so I think being and profile information world. So profile information on. Now, what I want to do is to displace several hitters. That seven several. What I want to do here is to display the information that West sent by using the HTML form . So I have to I want to create several military tax. I want to create four Heather the decks. So, uh, not a No, no. Sorry, sorry. Sorry. What I want to do is took to pass information police template that I just created. So, in order to pass information, I have to type being, uh our response. So I type in response dot render. And now I want I have to specify the template that I want to display to the browser. In this case, I want to display the template. Um I want to display the template response Does a year? Yes. So they bean response about a year? Yes. On what I want to do is to pass information, toe the template so I have to create an object on these objects. Will contain the property profile on then, uh, this practice object profile will contain people properties one his name on the value off these. The value of these property will be response The locals that name Now I want to add another property Gender on the value off this property will be responsible. Locals thought genders again. I have to work another property age on the value of this property will be response that locals that age on again I want toe at the property country on the value off these ah, property will be response. That look as the country now, as you can see why. What I am doing right now is that I am sending these information to the response. Does a year years template on the response dot a yes template is this file that Theis place on the screen right now? Well, guys, in the next lesson, I will continue working with this application. 21. MiddlewareEmpty 20: Well, guys, welcome back to another lesson of this tutorial. Now, in these listen, what I want to do is to continue working with are my up liquidity with the application, Onda. As you can see, what I'm doing right now is that these middle were function. He's he's displaying that template response toe a yes to the browser on at the same time at the same time, it is sending, ah, some information toe. The template, as you can see thes middle were function, is sending an object called profiled on such object contains four different properties. So if we go back to the template So the response told a guess file, we have toe improve these templates so that it can get the information on display the information In order to do it, the first step will be took test or to check whether they they they profile object exist, Andi know, in order to check whether the profile object exist, I have typing type off profile defined is different than on the fine. So basically, thesis statement is testing whether they profile variable variable exist. If the provide valuable exist, then the information will be displayed. But if they provide valuable does not exist then something else most happened on in the case in the cases when the profile valuable does not exist. What I want to do East to display. Ah, Heather One ahead. It tax. Sorry that contains these text. Oops. Uh oops and well Ah, the information waas not found. Okay, This is the message that will be displayed if the variable profile does not exist. Now what I want what I have to do is to enclose thes cold with thesis special syntax. This is the special syntax used by the temperate engine on. Now, what I want to do is tow letter mine. What happens if the variable profile exist on what happens is that three together three tax will be displayed for here. That the tax will be displayed on the first gathered that we display the name. So in order to display the variable, then the value off the variable name. Uh, well, if I go back to the to the Miller function, you can see that the variable name east a property off the object profile. So, in order to display the value off the property name, I have to take being profile the name and I have to repeat the process. In the next terror attack. I take being gender. And now I asked the especial Syntex that Theis place the value of the properties in this case, I want toe display the value of the property profile dot gender on, uh, now I have to go back to their So the meter were function on the other property that I want to display. He's the property age, so I have to take mean age. And then I have to ask the especial syntax on I want to I want to display the property age . So I think being profiled old age on on, you can see I we also have a property country. So I have to display the value of the property country on. I have to add on a special syntax like peace, and then type means, ah, profile dot country. Now I say the changes on now what I want to do is to go back to the to the comments prompt on. I want to stop the servers by by pressing the keys controversy. I know I have to restart the servers and Let's see what happens. As you can see these message this place which means everything is working now what I want to do is to go back to the to the HTML form and I want to feel in the text fields and I want to present don't send information and let's see what happens. As you can see, the template is this place to the browser on the template contains all the information that , uh, that waas sent using the the html from. But now what I want to do is to improve my application. So I have to go back to my coach on what I want to do is tow have a media were function I want to add a meter were function in between these two meter were functions that we have here so again, in order to add this meter were function like after they've seen this growth and in a coma on uh this middle were this this new middle were function will contain three parameters. Sorry, this middle were function will contain three parameters. So I have to copy that. I have to copy the parameters. I'm baste them like this on now As you can see, the first middle were metal were function, uh, saves the values sent by the HTML form inside variables. Uh, but now what? I want to go east to check whether such variables contained emptiest drinks. So if the variables contained empty strings, which means that the user forgets toe feel in any text field, then something something different most happen again. These new ah middleware function will describe what happens if the user forgets toe feel in a given text field. So, in order to to determine what happens, I have to tie teen uneven statement. And now I want to copy Ah, these valuable on. Now I'm goingto property lynched and then equals zero. And then I have to ask a logical operators like this. So if they give the variable name is empty or if the variable name does not contain a name or a text a strange, then it means that something is wrong and I have to do something about it so that that that is the poor post off this growth. So what I want to do is to repeat this growth at three more times, so I have to go be this coat on. Have toe based it like this on. Um, what I want to do is to change the variables name so they engender. Ah, age on country. So you can see this code is testing whether the variables are empty or not. And if the valuables are empty, what I want to do is to display a message to the council that says, Ah, some fixed feels are empty. Okay, so now what I want to do is toe check whether this code is working or not. So I have to go to the common prompt. I and I have to stop the server by pressing the keys controversy on Now I want to restart a server on now. What I want to do is to go back to the so there html form on. What I want to do is tow Remove the values from to text fields. And now I want toe Brezik they but don't send information on. Let's see what happens if I opened the command. Prompt As you can see, a new message this place, some text fields are empty, which means my application. He's able to let her mind whether some takes feels are empty or not. Uh, well, guys. Uh, well, now what I want to do is to improve his coat. So it I mean, the else statement on If all the text fields contain information, then these message this place to the console on, uh my such will be all the text feels all the pigs fields contain information. Okay, Now I have to go back to the common prompt. I stopped the servers by pressing control. See who started the servers. Let's see what happens. Okay? Everything appears to be working now. I have to go back to the the HTML form on. What I want to do now is toe feel in all the text fields and I want to preserve well, don't send information on. Let's see what happens if I open the common prompt now and you may search this place. All the text feels contain information on what happens if I forget toe feel in the name fix feel on the gender text field. Now it Chris Daewoo don't send information and I have to go back to the common prompt. And as you can see, Anouma such this place some text fields are empty. So my application is able to let her mind whether my text fields are empty or not. Well, now, in the next lesson, I will continue improving this application. 23. Midldleware 22: Okay, guys, welcome back to another lesson off this tutorial. Now, in the previous lesson, I used the response The ages filed toe handle the errors. But now what I want to do is to use another template took under the errors. So the first step that I want to take he's to remove the response dot a yes, filed. And I want to us b form. I thought a guess. Fire. Remember that the form dot Js file contains the HTML form. Now what I want to do is to go to the farm dot a s file on I have to improve thes template so that this template can handle errors. In order to do it, I have to type in ive that both and roar east different than east older than one define. So this is statement basically is checking whether a variable air or exist and if a variable error exist, it means some error has a coursed. It's so something must have happened. So if if If some error exist, then uh, what I want to happen is that I want to display the the form along with the Heather won Tak . So I copied its growth. But I want to make some improvements to this golf. I want to us. Ah, the property. I want to add the property they attribute value toe each off the text fields. So I asked them if they attribute value and now what I want to do. So what I want to do now east toe at a new value toe the attribute value. So I'm going toe, Uh, these are special syntax. And then I want toe. Um, if I go back to their If I go back to the error handler, you can see that a property name east past toe the template. So I have to specify such property as profile the name on. Now I have to repeat these steps for the other text field. So I take being value equals. Ah, this is special syntax and then profile dot If I go back to my ever hander, you can see that a property gender is past. The temp is passed to the template. So it I mean profile boat genders again. I have to repeat these steps. I have to add a property value to the other text field on. I want to display the value off the property age. So I being profiled old age on. Finally, I have to repeat these the's one more time. So I have toe at the attribute value on this special syntax, Of course. And then if I go back to the error error handler, you can see that that I have a property country. So in order to ask this display this property, I have to pay being profiled dot country. And now I I want toe do something else. I want toe. I have to display the error message. So what I have to do is to mm are feather went back after the bottom that Ah, that contains errors. Yeah, on again, like upto the special syntax. Remember that the error is the stores in a property called error as well. So I thought they bean and roof. Now what I want to do is to test whether all of this is working or not. So, um, I have to go back to the so they comment? Well, yeah. Okay. Okay. Now I have to go back to their response That a s file. Andi, finally, I just want to remove these This piece of code that handles the error. Because thes page is not going to this template is not going toe handle errors anymore. So because of the fact that this template want candle errors anymore, I can remove this piece. Of course. So I remove these growth like this can. Now I say the changes. Now everything appears to be working. So let's try this application. I have to go back to the common problems. Stop the server by pressing control. See? And then we started server. Let's see what happens now. What I have to do is tow uh, where I'm going. Toe, refresh this with page on. Now what I want to do is to feel in the name text field on the gender text field. On that, you can see the reminding text fields are empty. So now I present don't send information on Let's see what happens. Well, as you can see, everything is working. But ah, the form it displayed twice. So I have to figure out a way toe prevent peace to happen to prevent things from happening because the formless place twice So I have to correct that on Ah, okay. In order to correct that. I have to. Mm. Okay. I'm going to add a new growth. Ive uh, if type off en route if type of a roar ah, equals on the fines. Poon there on the find. This statement, uh, means that thesis statement can be translated as this is statement can be translated us if the variable a roar does not exist. What happens? Okay, if the variable error does not exist, what happens? Well, uh, what happens is very simple. I just want to display on empty on empty html form. So I have to copy to go to this growth like these. And now I want to based it inside they If a statement like this so you can see my template behaves in a different way. Uh, depending on the variable, ever if they variable ever exist. Ah, something happens. But if they variable a variable error does not exist, then something else happens. Okay. Okay. Now what I want to do is tow Go back to my application on, uh, I want to Okay. I want to refresh this base on now. What I want to do is to feel in the first thinks feels on. Now, as you can see, the reminding text fields are empty. Now I visible don't send information, and let's see what happens. As you can see, my application is working. I never message this place ever. Some text fields are empty, but if I feel in the missing text feels on, Then press the button. Let's see what happens. Okay, Another template is used. So s so far, my application is working. My application is able to handle, uh, Aeros on. Well, I just want to make one last improvement, so I have to its growth down. I'm going to add some color to these sweat. A Penis style cooler. Red. No. Um Okay. Okay. Okay. And I want to run this application one more time. Uh, okay. I'm refreshing these this page. Now, again, I have to use this application one more time. Um, I feel in the 1st 2 text fields on, uh, the other text fields are empty. Now it president wants and information. And as you can see, a never displaced error. Some text fields are empty. But if I feel in the reminding text feels on, then I president on. Let's see what happens the application uses another template. So, uh, so this application is ableto candle? Uh uh is able to con the errors by you think these these error handers or these middleware functions that handled errors on Well, guys, this is it for this lesson. Now, in the next listen, I will show you more about no JDS and express. 24. Deploy 23: welcome guys to another lesson off this tutorial. In this lesson, I'm going to show you how toe the ploy or publish your application to the Internet. So in order to understand how to publish your application or help to the blow Europe how to deploy your application, you have tow use to services or well, you have to use one service. Ah, the services known as gold cloud platform Google Google Cloud Platform enables you toe use several services that Arab eye level through the Internet. So, um, one of the services that are high level or one of the services that Google Club that platform offers is a service that is known as up engine up engine enables you, Tobu, publish your applications. Well, as you can see right now, I am, uh, I am in the Google Bache in over in a Google pace. Andi at you can see the one of the results, says Google. Google Cloud don't come. So I have to click this link on. Let's see what happens. Well, guys, now, as you can see, I am inside Gold Gloves platform on will Google Cloud platform offers, uh, offers a certain amount off service free of charge. So in this case, well, would cloud Platform offers a free version of the service as well as a paid version off the service. So in this case, I'm going to use the free version off Google Cloud Platform. So the ploy or polish my application. So, as I said, Google Cloud Platform offers two versions off the service. One version is free On the other version, Uh, he's require spade payments. So in this case, I'm going to use the free version. So the first step is that Doobie City's website Google Cloud, and then you have to sign up for a free account. So, as you can see here appears um ah, Bhutan that says Get started, get started for free. So I'm going to click This would, um on Let's see what happens. Well, guys, as you can see, Google Cloud Platform uh, he's asking me to provide some information so that I can sign up for a free account. So I want cover teasing this tutorial, but I just need to open toe, create a free account in Google Cloud Platform. That is the first step that took up to take on The second step is to is to use on what is known as the Google Cloud Software Developer Development Kit. So, as you can see in the in the screen of years, uh, Google result appears a serious off. Google results on the first results, says Google Cloud Software Development Kit. So, um, the other tools that we need in order to publish our application is to use the Google Cloud software developed. So our Software development Kit development kit. So I'm going to click over this link on Let's see what happens. Well, guys, now I am inside the Google Cloud Google Cloud Software development kit on Well, this is basically a program that you have to install in your computer. It's a comment line program. So, uh, you have to don't both, uh, this program. So what I want to do is to Well, I have to install these Trumpy style this program in your computers on your computer, so I'm going to get the Bhutan installed for Windows on. Let's see what happens. Okay, guys, after clicking after clicking the link because it was paged at this place and basically what I want to wear, what I want to do is to download the stellar off the top off the Google Cloud Software developed development keep. So I sell it. I clicked the link that says Google Cloud software development Keep installer. I click the link on. Let's see what happens. Well, guys, as you can see at the bottom left corner over your screen Uh, a program has bean download this. So I'm going to open this program on. Let's see what happens. Okay, as you can see, uh, here I have the Google Cloud software developed the bell off men Keat installer. So what I want to do is toe the right league. OK, guys. Now, as you can see on the Google Cloud software developed development kit installer appears on , What I have to do is to rest leak over the installer, and I'm going to select the option open on. Let's see what happens. Well, guys, now, as you can see, the stellar this place. So this is a stellar that is going is going to install a Google Cloud Software developed development kit on my computer. So I heat next. Now you select the Bhutan. I agree. No, uh, I'm going to select the next on going toe. I'm going toe. Press the button. Next one more time. Okay, I'm going toe press the Bhutan. Um install on. Let's see what happens. As you can see, the Google Cloud software development kit is being in style on my computer. Well, this process takes a while. OK, guys. Now, as you can see, Google Cloud software development kit is already installed on my computer. Now I hate the boot on next on. Now heat the wood on finish. Now, as you can see, a Google cloud is already working in the in my computer on now. What I want to do. Okay, what I want to do is to get over toe toe the application to the last application that we created. Andi, I have to create, um I have to make some improvements to this application. This is the abdicate, the last application that we creative the application when this is the last application that we created. So what I have to do now is to clear a new constant on the constant will be port on its funny will be set to process dote in my room ente dot Okay, process don't end enviromental those port on. Then I have to take being these logical operator and then the port. 3000. Now what I have to use, what I have to do is to scroll down these file as I'm going, I'm going to use I'm going to remove the board 3000. Andi, I'm going toe typing the constant port. Yeah. Now what I have to do now is to create a new file in the root folder. So I select the option new file on, uh, the name of this fight will be up AP dog jum at dot Sorry. The name of these file will be up dot at the jam is it's very hard to say these, but is ab both jum? Sorry, guys. The the name of this file will be absolute jam. OK, It's a bit difficult, but to put to whom the pronunciation. But you have to name this file up the jam jam. Okay, I pay attention to the extension of this file. Uh, ab vote jam. Okay. I'm sorry for the pronunciation. Please pay attention to a to the extension of this file jam or something like that. Now he'd save on that. You can see the file up. Thought jam has been creative. And now you have today today, bean room time on. Then you have to specify note. Yeah, I guess. Version eight were you guys? As you can see, this is the only line. This is the only piece of code that you have to create inside this file. Inside the file. Abdel Jam. I know. Uh, what you have to do is to head over to the firecrackers, Jason. And you have to have what is known as any script in this case, the script. It will be a start on, um they value for these property will be no server dot Yes. Okay. This is very important. Otherwise your application and one work Andi will vicious it for this lesson. In the next lesson, I will continue working on help with employees or publish on application. You seen whole cloth 25. Deploy 24: Okay, guys, welcome back to another lesson of this tutorial. In this lesson, I will continue working on the previews project so well. And now what would you have to do after after? After making the improvements to the Packers Jason file. And now what you have to do is tow it over to the Google Cloud's website and you have to select the option that says console. The option is placed at the top right corner of your screen. So select console on. Let's see what happens now. As you can see, I am inside the Google Cloud platform console eso. What you have to do now is to create a new project. So in order to create any project you have tow, select the option you have tow, select the both the option at the top of your screen on now you have to select the option new project. And now let's see what happens now as you can see this easy with page that this place so I have to create a new project. As I said, Ah, now I have to sit. I have to say the project name on the project name will be no guess. No jail. Yes. Besting. Know Jay is testing will be the name of my application off my project. Sorry. Now I heat. They will Don't create Andi. Let's see what happens now. As you can see, this is the webpage that this place now what I want to do is to select the project that I've just created. So I have to click the option at the top of the screen on Let's see what happens. As you can see, this is the Web page that at this place this is the window that this place. So now what I want to do is to select the project that I just created. In this case, the project is, uh, no genius testing. So I selected Project on. Now I select the option open and let's see what happens. Well, now what you can see, this is the webpage that this place on this is the the dashboard for the project. And no judge is testing. In other words, thesis the passport for the road for the project that I've just created. Now I have to click the menu icon, uh, found at the top left court. I have to click the menu, the menu icon that is found at the top left corner on Let's see what happens. But you can see the menu, this place I mean, you like this place. So what I want to do is to use the service that is called is called up engine. So I select up engine and I'm going to select the That's worth now. As you can see, this is the dashboard. This is the engine that work on. Now. What I have to do is to press the button that says, Create application and let's see what happens now. As you can see, this is the webpage that this place that this place. So I'm going to press the Bhutan, create application and let's see what happens now. As you can see, there are toe drop down menus. Uh, the first menu. I have to specify the language that I want to use. So I want to use no j Yes. So I choose No Js on now. I present will don't next. Let's see what happens now You can see this is the This is the the webpage with page that this place. So now what I want to do is to go to my go to the dance sport. So I select the option palm on. Let's see what happens now. You can see a am inside the Devesh war for my project on. Well, now what I want to do is to go to the Commons. Problems on you can see. Right now I am inside the root folder for my approach. The root folder for my application. So now what I want to do is tow type in Google clouds. Uh, Dunphy set project. Now what I want to do is to copy the Ivy off the project. So I said like that. So I select the idea of the project. Okay. I have to select the Ivy off the project like this. Sorry. Sorry. Okay, I said, like the idea of the project. I copied the idea of the project on. Now, what I want to do is tow based the ivy off the project like this. Now what I want to do is tow is to heat. Enter on. Let's see what happens. Okay, after that, after ruling that comment what I have to do, um, in the previous comment, the comment Google Cloud conflict said Project are you specifies the project that I went to use. So in this case, I want to use the project. No judges testing. So that's what we need in the previews. Comment. Now, what I want to do is to typing Google Cloud, uh, up the ploy. And now I have toe hit. Enter on. Let's see what happens. No, you're gonna see, uh, Google Cloud is asking me several questions. Well, he's asking me a question. It says that if I want to continue So, um, I think bean guess on I heat ender on let's see what happens. As you can see, a Google clothes is is the cloying my application. So this process takes a while, of course. But as you can see, Google Cloud is who clothing my files. Or, in other words, Google Cloud is publishing my application. This process takes a while. Ah, but well, I want to show you what what happens on the government prompt. So I'm going to let I'm going to I'm going to let you see what happens on, uh, you can see the process takes a while, so I'm going to skip this part off the process. OK, guys, now, as you can see, the process gas already finished. Now what? I want what I have to do in orderto see my my application east of being Google Cloud. Uh, Breaux's now I heat enter on Let's see what happens. So, uh, well, it is important to say that my application has bean a published. So in other words, my application is already available online. My application has been pulled. Bullish on is already a high level, uh, in the dirt It it's important to say that the application will be displaced in the in a new in a new tough inside my browser. So as you can see, my application has already being published. But if I go back to my application, you can see that in order to run my application, I have to take being its last profile. Ah is less profile is lash in boot, so I have to go to the browser. Anti team is last profile. His last profile is lash England Now heat entered and let's see what happens now. As you can see, uh, now you can see the application is working on Castle. Really being published. Eso uh Let's try this application. I'm going to feel in the that the text fields So I'm going to take being all right number Then genders will be said toe male So now the gender will be said toe mail The age will be said toe 40 on the country will be said to Mexico now President, don't send information on Let's see what happens. As you can see, my application is already working Now if I go back to their toe the if I go back to the HTM a form on If I, um if I feel in only toe text fields on, let the other text feels empty Now if I president but don't send information, let's see what happens. I never met such this place. So now I'm going to fill in The missing text feels so I think being 20 on then country Mexico, ny prison don't send information. And as you can see, my application is already working. Aan has already bean the boys or published to the Internet. Well, guys, this is it for this tutorial on, uh, see you in my next tutorials by 26. MongoIntroduccion 1: welcome, guys. Toe another lesson off these video tutorial on dwell in thesis video tutorial In this lesson, I will I will introduce a new topic. Andi, I'm look to you about mongo db Atlas. Um well, when we are you seeing No, j yes, we have toe way need toe have a lot of ways that we can use in orderto get information Andi then used such information inside the application. So in this case, the database that we are going to use Eesti that always mongo db address. As you can see right now, I am in the Mongol TV at last website or in the Mongol DB website. Andi, Once you are in the mongo DB website, you can see that these he's the one of the main with spacious that are displayed. Well, now what you have to do is go to the mongo db website. Andi. Then you have to look for the service known as mogul Devi Atlas Mongo db Atlas is a service that enables you to a store at that arrays in the cloud. A mongo db Atlas is a service that enables you toe story or that obeys in the Internet and you don't have to worry about the configuration. So that's one of the reasons why I will be using mongo db Atlas. Because by using movie Atlas, I don't have to worry about the configuration and installation process off the database. Well, now, as you can see, this is the mongo db Atlas website on. Well, these thesis service mongo db Atlas offers a free a free version. So in this case, I'm going to use the free version of the service on the first step is to press the button that says they start free on the button that says to start free is located at the lift off the screen. So President Putin start free. And now, as you can see on a new HTML form this place and the first step is to create a new user account. So now what you guys have to do East toe, create a new you sir account. Okay. In order to create a new user account, you only need to provide your email address your first name, last name on a password. Well, this process is very straightforward. Very easy. So I won't cover how toe create a new account. Um because you you understand how to do it. So in a few words I use have to say that you have to be seated the website mongo db at last or Mangala Devi on. Once you are in the mongo DB website, you have to create a new user account. Remember that we we will be using the free service. Okay, guys. Well, after looking after logging in tow, the mongo db at last website, you can see that this is the webpage that this place. Well, as you can see, I've just, um, locked in into the website. Andi. Well, this is the Web page that this place now, what I want to do east to create a new project, uh, that which I will be using to work with No, j. Yes. So, in order to create So in order to create a new project which I will be using to work wheat . No. Yes. To press the drop the drop down menu at the left side of your screen. So head over to the left side of your screen on the Reese drop down menu. Now you have toe open. Did up the drop down menu on Select the option New project. Okay, guys will, after selecting the option, create new project. You have to provide the name for the project. In this case, I'm going to use I'm going to create a new name for this project. On such name will be learning. Learning knows on a mongo learning note. Mongo will be the name off my project. Now you have toe head over to the right side, off the screen on President Bhutan. Next, as you can see to the right side off the screen, the research green button that says next. Now you have to press the brutal next please. Okay, guys, after pressing the Bhutan next, this is the with page that this place, this patient is used the space this webpage is used toe set permissions and users. But in this case, I'm going to use the default options. So I want at any users or permissions. Uh, so what I'm gonna do what I'm gonna do now is to press the button, create project such Bhutan is found to the right side off the screen. Please press the button. Create project. Okay, guys. Well, after creating the project, uh, This is the webpage that this place Onda. As you can see, I have to create what is called as a cluster. I have to create a cluster. So please, you have to press the button, build a cluster. So our president Tamweel a cluster on. Let's see what happens. Okay, guys, After pressing the button, create booster. This is the webpage that this place on that you can see. You have to select the cloud provider. In this case, I'm going to select the Google Cloud provider. As you can see, I am selecting the Google Cloud provider. I want it now. I have to scroll down. And as you can see, we are using the free tire. There we are using the free tire A service. So remember that we are going to use the free service, the free version off these service. Okay, so make sure that you select the option that says free tire available. Okay. As you can see, I this option appears selected by default on, uh well, makes you make sure that you select the option free tire by level. A such option, says Uwe as well. So make sure you select Thea push in Iowa on. Then you have to scroll down Andi, As you can see by before we are using the free version. As you can see, thes rectangle over here says free forever. Which means we are using the free service. Okay, on if I scroll down the with the with page, you can see that there is an option that says cluster name. So you have to tow place a name for your rooster. In this case, the name of the name off my Gloucester will be windows, Raimundo. Loose dish. Well, my name is Raimundo. That's the recent way. I Why? Why? I'm using the name Raimundo A nice on the name of off my cluster East Raimondo cluster. So now hit over to the bottom off they with Paige and press the button create cluster At the bottom of the page, there is a green button that says create booster President Putin on Let's see what happens . Okay, guys, As you can see, the cluster is being creative and will thes process takes a while. Ah, this process takes some minutes. So you have to wait for a while before our booster east. Creative. So I'm going to skip this part off the process and I will come back after the booster has been creative. Okay, guys, as you can see, our kuester has been created on thesis is the appearance that off the sport after the cluster has been created. As you can see, the rooster right Moonda cluster hassle recreated on. This is the place that are willing to use this the dashboard that we are going to use to create that basis collections and documents. Well, when we worked with a mongo DB, we use what is known as collections on documents toe a store. The information. Well, this is it for this lesson. In the next lesson, I'm gonna show you how you can create a collection as well as documents so that you can store your information inside mongo db Atlas 27. MonmgoIntroduccion 2: Okay, guys, welcome back to a nice one of these video toria. Well, in this lesson of this period, Pretoria, I'm going to show you how to a store. Some very basic information inside the batteries. So in order to a store, some very basic information inside the database, uh, the first step East Press the boot on that says collections. Okay, so now you have to I'm gonna press the button that says collections and let's see what happens. President Putin collections Well, guys, after pressing the Bhutan collections, this is the webpage that this place, as you can see at the top of these web page Ah, there is a section that says Collections on Now, at the bottom of this page, there are two buttons. One Bhutan say's loath sample that asset on the other. Bhutan says at my own path my own batter. So now what you have to do east to press the button at my own data. So now, President, on at my own data on that, you can see this is a window that this place and we have to introduce the that of his name . Of course, we have to create a new database as the first step. So in this case, I'm going toe create a new database on the name of the batteries will be profiles on Ah, we also have to create a collection. Well, in mongo DB collections are similar to tables. So in this case, I'm I have to create a collection which is similar to a table eso. In this case, my collection will be my collection name will be, uh, lodgings Loggins. And now I have to prison built on create. And as you can see, things process takes takes a while on Well, now, as you can see, we have created the database profiles on inside the that always profiles. We have the Logan's collection. So DeLeon's collection collections are similar to tables in mongo DB. So when When I say collections, I mean, um, the places where the information will be stored well again, convictions are similar to tables. So in this case, we have created the collection Loggins. Well, now what I want to do, he's toe insert some information inside the that always. So I'm going toe hit over toe there, right side off the obvious screen on on the right. side off the screen. You can see that the reset button that says insert document. So you have to press the Bhutan insert document President Tony, answer Document. Let's see what happens now. You can see this is the window that this place and I'm going to create my first entry for the database. So I'm going to add a property. In this case, the property will be user name on. The value of this property will be right. Moved on on now I have to brace Inter. Andi, I'm going to add a new property. In this case, the property will be email on. I'm going to ask a value to this property and the value will be Hello. Hello, araba e mail dot com Now it presenter and I'm going to add another property. In this case, the property will be password bass work on. I'm going to add a random passport. In this case, the passport will be 12345 This is only a random password on. Now I have to press the button that says insert. Now, as you can see at the bottom off these window the restructuring Bhutan that says insert so President on insert on, let's see what happens now You can see a new document has seen a teeth toe the Logan's collection. As you can see, these new object that appears here is called Document. So as you can see, the information in the database is extort as objects as Jeff discrete objects and, um, on such objects or such JavaScript objects are also known as documents. So when I say documents, I mean I JavaScript object that has bean is tort inside the database. Well, as you can see, we have just created a single document, but I want to create another document. So I'm going to press a button insert document that is found on the right side off the screen. President on insert Document One more time and I'm going to other new property. This document, the property will be used. Her name on its value will be Nicole Chris Inter. Now I'm going to take being another property email on the value of this property will be any cold araba gmail dot com Now for a centre and I'm going to add another property Passwords on, uh, on the value of this property will be again a random password. In this case, the password will be 12345 So now, as you can see, I've just created a new document. Remember that documents are JavaScript objects on well, and now I have to press the green button that says, Insert on, Let's see what happens now. As you can see, I've just created two new documents inside my database on um, Now I want to create one more document. So I get over to the Bhutan insert document that is found on the right side off the screen . I present atoning certain documents, and this is the window that appears one more time. Yet the property user name on the user name will be Michael Press. Enter now I at the property. Email Monday, May The email will be set toe Michael a robot. Gmail gmail dot com Now I pressed enter and I'm going to have another property. In this case, the property will be passed work and the value of this property will be said toe. A random password on the random password will be 12345 Now I press a button insert and let's see what happens now? You can see three documents. Have bean Evite toe the database on these pre documents or javascript objects contain, um, the profile information off three different users. And as you can see, such documents are stored inside the Loggins Collection on the Loggins collection is stored inside the profiles. Batteries? Well, guys, this is it for this lesson on this is only an introduction to mongo db on in the next lessons, I will continue working with it. I will continue working with a Mongol TV atlas. 28. MongoSaveInfoExercise 3: welcome, guys. Toe another lesson of these video tutorials. In this lesson, I will show you how you can, uh, how you can create our wife application. You seen no deal? Yes, on mongo db. So, in order to create with application, you've seen no judges on mongo db. The first step is to create an empty folder that will be the root folder off the project. So as you can see now, I have the console. I'm going to create a new empty directory. You seem he the council. So I'm going to take being well, I'm going to navigate toe. They risk top off my computer. So I type in the comments change directory the stop. Now, what I want to do is to create an empty folder. So I take any comment make here on the name of the father will be a mongo up one. Now he enter. I know what you can see. I've just created a new empty folder. Now the next step is to navigate inside such folder. So I have to take being change directory among go up one no, for center. And now you can see I am inside the root directory. Manco up one. Now what I want to do is to create a backlash. Jason file. So I type, I think being the comment told Package man a year in it. Press enter on. Let's wait for a while. Remember that the first step is to create a packers Jason file on the Packers. Jason file basically contains the description of the application. Well, now, as you can see, a note package man a year is asking me to provide the Pakis name. So I press enter in order to use the default value. Now, I have to provide the version of these application I hit. Enter. Now I have to provide a description. And the description will be a mongo, uh, knows guests with up with application that you says mongo db. That is the name off the that is the description off the application. Now I'm going to provide what is what is known as the entry point. The entry point will be server DOJ. Yes, Remember that. Remember that This file contains the server I percenter hit. Enter The key words will be a Mongol. No. Yes. Those are the key words Hit Entered the outer Well, uh, the property outdoor will be set toe my name, which is Raymondo. I hit Enter. And now I finally type mean. Yes, an advocacy. I just created a packers Jason file. Know what I have to do is to open the code writer and I have to navigate. So the root folder that I just created remember that the root folder he's found in the risk stuff off my computer. So I have to select the disk top, and now I have to select before their mongo up one. Now, I select the folder Mongo up one. And as you can see, any window opens on these window contains the root folder as well as the packets J so file . Well, now what I need to do is to go back to the to the console and I have to install the dependencies that I need for this application. So in order to install the dependencies, I have being no Turkish mantle your instant double that safe now In this case, I'm going to use express I'm going to use um Hey, you. Yes, I'm going to use boy part, sir. On Finally, I'm going to use a new dependency. Such dependency. Ease the mongoose dependency by typing mongoose dependency. Mongoose enables you to connect to the database again. This is very important. The mongoose dependency enables you to make connections to the data ways on to perform operations inside the database. Well, now I have to heat enter on that. You can see. Um, the dependencies are being installed inside the project. Well, guys, now, as you can see, the dependencies have already bean in styles inside the project. And if I go back to the pack cachet so filed, you can see that the dependencies appear in the package. A So file for the part, sir. A a judge's express and moves. Now, what I have to do is to create the these the file server Dodge a guess. So I have to select the option you file on. I'm going to save these file as server. Both JDS I hit enter. And now as a as a first step, I have I have to declare the dependencies, so I have to type in a comment. The tendencies on ah, dependencies. The pain then sees at another in orderto declared the dependencies dependencies. The first step will be to clear a constant express on its value will be said toe require express. Now I'm going to declare a constant act on its value will be set toe the Function Express Now I have to declare the constant bat and its value will be said toe require Pat Andi Finally, I'm going to declare one more constant. The constant will be a mongoose Moon Goose on the value will be set to require mongrels on this is it. Uh, Now what I want to do as the first step is toe is to create a road. So I think by typing the comment wrote on, I'm going to create a road that is going to send on HTML form to the browser. So in order to create a road that is going to send an HTML form to the rouser, I have to take being up the get Then I have to take being on the road. In this case, the road will be, um, new user new user. I have to create the callback function. Remember that these function has two parameters. The first parameter east request 22nd parameter east response. Now what? I want to do is to send on HTML form to the browser. So in order to send an HTML form to the browser, I have to take being response that, um response thought renders Onda. Now I have toe have to specify the HTML template that will be sent to the browser. In this case, the tempering the template name ah will be a new user that a yes on. Finally, I have toe specify report. That's what they mean up. Don't listen Now I have to specify the Deport 3000 aunt. Then I have to declare the function that will be run if everything is working fine. So if everything is working fine, the's message will be sent to the console on the massage is listening at local host 3000. Well, now, as you can see, if I go to the road, you can see that I'm using on html template that is called new user dot A. Yes, off course. Such template does not exist, so I have to create the template new user dot a Yes. So now what I want to do is to add a new suit directory. So I select the option you folder. The name of this directory will be abused Are now inside this soup directory. I have to create a new template. So I have to select the option you file and I'm going to save this file as a new user dot Yes, As you can see, this is the template the HTML template that will be sent to the browser. Remember that these think late contains HD milk Oath. Now the title for thes html template will be a new user on the's template Will have Ah Heather want that? That saves new user as well. I knew you, sir. And now I have to specify the form. Ah well have to specify a forum. The's farm will use the post method to send the information to the browser. On the actual attribute will be said toe Ah, the action attribute will be said toe submit Aunt. Now these this forum cast two para perhaps as well as an a single button. Thea attribute the attribute the type attribute for this brutal will be submit on the value of this Bhutan will be Ah save you, sir. Okay, Now, um well these so released this form will have 33 para grabs. Now in the first paragraph way, we're going to specify the Huser name and we have to ask what is called. We have to add a text field on, um, the name of this text field will be user name. Now what I have to do is to specify on another devalues off the second paragraph up on the second paragraph will be used to specify the email. And I have to ask I have to add a text field on, uh, the type of these the name of these text field the yusor email. Female. Now I have to add one more, uh, paragraph on the value on the third paragraph will be used to specify the password. So I'm going to add Ah, a text field. In this case, the attribute type will be set toe passwords on theatrical name will be set toe you, sir. Fast work. And that's it. I've just created Thebes plate now I have toe have toe configure a year. Yes. So I have to create a comment configured configure your yes, on. Um well, in order to configure a yes, I have to take being upset on view engine give you engine will be set to a year. Yes. And now I have to add another upset statement on, uh I have to specify. We have to specify the folder that contains the the HTML templates. So in order to specify the folder that contains the html HTML templates, I have to use tomato join from the back dependency on I thought to be in your name. Remember that the constant your name contains the pat toe, Their root folder again. This is were important, the constant their name contains the bat. So the root directory. Now I have to specify the folder that contains the template, the HTML templates in this case, the folder that contains the HTML templates He's the views folder on. Well, I guess this is it. I've just confused. I've just created the server and I've just configured the template the HTML templates. So this is it for this lesson. In the next lesson, I will continue working on these application that uses node.js as well as mongo db 29. MongoSaveInfoExercise 4: Well, guys, welcome back to another lesson off these video tutorial. Well, in these listen, I will continue working on the application that that uses no JDS as well as, um mongo db. Well, as you can see s so far, we have created the server dot Js file on the server dot Js file contains a single road that sense the HTML form to the Web browser on these Sir brittle Js file also contains the Comte de configuration for the template engine. Now that you can see thes application contains an HTML form that is going to be sent today Web browser. Well, now what I have to do is to test this application. What I want to do is to check whether this application is working well or not. So I have to go to the console on what I want to do now East to run the comment. No server dot Js I hit. Enter on. Let's see what happens. But you can see the moustache listening at local host 3000 displace, which means everything is working well so far. So now I have to go back to the Web browser. Well, I'm going to take being local host 3000 slash Ah, new users I heat enter. How did you can see the HTML firm this place to the browser? So so far, everything appears to be working now I will continue working on this application. Well, what I want to do now is to make a connection to the batteries. Well, as I said, I have to make. I have to make a connection to the database. So I type in the next comment. Ah, connection through the batteries so that the race now, in order to make a connection to the database, I have to use that he met off Mongoose Thought connect. Now, these method fast two parameters The first parameter is the connection. Strange On the second parameter is an object that contains the property use New u r l use. Sorry. Use use new You are l bar search on these property will be said true. Now what I have to do is to provide the connection string on in order to have access to the connection is training. I have to go back toe mongo db on, uh what I want to do is tow Go to the cluster section, so I have to press the Hyundai on the left side off this off the screen, off the lid on the left side, off the screen. The recent option that says clusters. Now you have to press the option clusters on. This is three webpage that this place Now you have to press the button. Connect again. Press the button, connect. As you can see, we have a Bhutan connect. Now you have to press the button. Connect on Let's see what happens. But you can see this is the window that this place now, uh, you can see there are two options. The reason option that says that says white least your connection I p address. So, uh, there are two options at eye level. The first option says after your current I P address on the other option says have a different I P I P. Address. So I'm going to select the second option that says, at a different I P address on. Now I'm going to ask, um, a random I p address. In this case, the I P address will be syrup on zero foreign zero points 00.0. Now I prison put on half I'd be address. As you can see, the re siren Bhutan that says at I p address President Putin on that seat. Things is the first step. Now the next step east to create a mongo db yusor. So in this case, the user name for the new user will be a route on. Uh, the password will be said do Ah, hello. Hello. Will be three new password. Hello. Very as you can see, this is a very random password. I have created a use earning route on the password for such user name will be Hello, Now what I have to do. East Teoh. He's to press the button that says create mongo db user that you can see the reset button that says create manga TV user Press the button This is it. I've used creative Ah, a new mongo DB user. Now I have to press the button that says, Choose a connection Metals President Button that says choose a connection metals On this he's the window that this place on what I want to do is to press the second option the option that says connect your application, select the option, connect your application. And as you can see, the Reese connection is strange here. So what I want to do now is to copy the collection of strange Andi I President on copy. Well, this is it now. I president close on. That's it. Now I have my connection string. Now I go back to my application on based the connection string like this. Now what I want to do is press pleated my collection strange into several pieces so that we can better understand what we are doing. Have a seat I have. My connection is strange. Now, as you can see, I have a Knop shin that says password. I have to delete this option. I'm going toe to replace the password the past. I'm going to place my password. Remember that my password is Hello. Now if we pay attention Well, let's go back to Mongo db On now, press the option pressed president who? Toll collections, press the button collections and let's see what happens. As you can see Well, we have created a database profiles, but you can see we have here at that always database profiles. So I'm going to go back to the growth and I'm going to delete the test. The test that always I'm going to replace on. I'm going to take Bean the name off my database in this case, the name of my database. He's profiles on this is it. And now what I want to do is tow. Verify whether the connection works or not. So I have to use Ah, the next methods. I happen typing Maru's the ah collection dot own a road. Now, as you can see, these function will be run, give the connection fails. So if the every connection to the batteries fails, I want to display a message to the console that shows the error. As you can see now, uh, I'm going to create another function that will be run if everything well, I'm going to create another function. The dysfunction will be used if everything is working fine. If everything is working well, thes these function will be will be used. So I have to take the mangoes thought connection that once and then, um open. Remember, this is this is the function that will be used if everything is working Well now, if everything is working well, how moustache will be sent to the council on the message will be a success. Uh, the connection. The poor Nick, the connection is working. Okay, so I know what you can see. We have two functions. One function is used if the connection to the data ways fails on the other function is used . Every connection to the data ways succeeds well. And now what I have to do is to go back to the council on. I have to stop my application. In order to stop my application. I have to press the keys control. See, this is very important. In order to stop your application, you have to press Tiki's control. See, Now press controversy on. Then I have to restart my application and let's see what happens. Okay. Um okay. So far. Okay, As you can see. And you Miss Ash, displaced to the console on these massage says success. The connection is working, which means we are already connected to the batteries. So this is it for these. Listen, now you know how to make a connection to the database. Now, in the next lessons, I will continue working on the's application that uses no genius on mongo db 30. MongoSaveInfoExercise 5: welcome guys to another lesson of these video tutorial on Dwell in these lesson off these big a tutorial. I will continue working on the application that do says mongo db So s So far we have created act. I would have made a connection to the database. On that, you can see the connection is working. But now the next step east toe create what is known as our schemer on a more than so in order to continue working with mongo db you see Mongoose, we have to create an A schemer as well as a model. So I'm going to take being a comment that says creating create things on a skimmer on a scheme creating an a scheme and I'm older on dwell in order to create on a scheme I had to declare a new variable. So I think bean let ah gustan scheme Costa Miss Kim. As you can see, I've just created a variable that is called custom Custom is is Kim and now I have to take being new vein mongoose and then the scheme. And as you can see, I've just I have to create an a scheme on well, basically on a scheme. He's a description off the documents that will be a Stort into that race again, this is very important artist on a scheme is a description off the documents that will be restored inside the batteries. Now, if I go to the mongo db Atlas, you can see that I so far I have creative pre different documents on each off those documents has three different properties. One property is user name. The other property is email on the earth. Property is passport. Each of those properties he's off the type. Strange. So I have to create a description off those properties. In other words, I have to create a description off the documents and such a description is called on a scheme on a schema. So, uh, as you can see, the first properties user name aunt, he's, um, strange property. So I have bean user name a string. Now, if we see a so you can see the other property East email on the property email is off the type. It's drink. So I haven't bean email type a string. Now if I go back to mongo db, you can see that the res 1/3 property, the property password and the property password is off the type A strange as well, so I have to take being passport and then a stream. Now, as you can see, I've just created a description off the documents that will be a stored inside the that always and this is Christie's description is known as I skim it. Now what I have to do is to create a model, so I have to declare another valuable Andi variable will be costume custom model. In order to create a model, I have to use a method. Mangoes thought model on this method will contain will describe the that the collection that will be used toe stores the documents again. These were important. The model describes the collection that will be used to a store, the documents or the information. Now, if I go back today Mongo DB, you can see that we have the Logan's collection. We have theologians collection, Andi Logan's collection. He's placed inside the profile status ways. So as you can see, we have created the Loggins collection, so I have to go back to my coat. I type in on typing logging now. Uh, As you can see, I just I just type in logging without this is looking is the singular version off the world . Loggins. So in this case, the collection name is Loggins. Uh, on Duggan's is the plural version. But in the imam goes, we are going to use the singular version. So what? I've been logging without the letter s. So this is the singular version. Looking Andi again, Logan is the singular version off the off the worth Loggins. So Loggins casts the letter s on looking ah is missing the leather s. So this is very important. You have to use the singular version off the worth in this case and using logging, which is the singular version off Loggins. Well, now you have tow Specify the scheme, the schemer. So I have to take being costume a schema. And so far I have created what is called a PSA model on eyes on any schemer. Well, guys, as you can see, s so far we have created on the schema as well as a model. On on schemer is a description off the documents that will be a stored inside the database on the model is our description off the collection that will be used. Tow us to a store. The information for the documents. Well, now the well, guys, now the next step east toe, get the information that the user is going to send to the server by using these HTML form. As you can see, we have here on HTML form on. I have to get the information from these HTML form in order to get the information from thes HTML form I have to use for the purser's. So what I have to do now is to coffee your body part, sir. So I'm going to declare another constant body. Parsons found in body parts or equals require body Parsons body parts. Sirs on. Remember that body part, sir enables you toe get the information from the HTML farms. So now I have to configure body part, sir. And I'm going toe typing a typing a comment that says configure body parts ish and in order in order to configure what the parts there, I have to take up the use. Then body parts search dot You are l in cold it on, uh, then extended force Force Andi again. I'm going to use up the juice. A body Parsons of the juice. But the person took Jason. And this is it. I just configured body part. Sir. Remember that Billy Parsa is the dependency that enable Jude enabled you enables you to get access to the information that the user soup meets toe the server by using theeighties demon form. Well, now I have to get the information that the user sends to the server by using the's HTML form. So, uh, if we if we go to the Koth, if we go to the HTML template, you can see that the information will be sent. So the bash soup meat wrote, As you can see, the information off these HTML form will be sent to the server. Using the post method on the road will be, uh, dash super meat. So, uh, now I have to create a road that handles the post metals as well as the bash soup meat wrote. So I have to go back to my server. I'm going to take being, uh, after the post, Then the road will be dash submit. So read That's that. Shoot meat, Sufi meat. And then I'm going to go typing the function. I'm going to declare the function that is going toe handle the the input from the from the HTML form. Remember that this function fast two parameters request on response on. Now I have to declare the variables that will store the information from the HTML form. So I have to typing the comment. He store the information then he store a store. The input the user input Ondas I said I have to declare a variable. In this case, the variable will be bar user name on its body would be set toe request that body. Remember that the object request that body. He's the object that stores the information from the user the information that the user passes to the server. So I think being dot I remember that the attribute name off the first text field He's user name So I had to take being use her name now another valuable Let a bar Ah, you serve. Use our email Are you sir Email on its value will be set to request that body that now if I go back to the HTML template, you can see that the second text field cast an attribute name Equal Toe Yusor email. So I have to use that you, sir e mail again. I have to You the dickler Another variable. The variable will be bar. Um, Bart Passwords on its value will be set to request thought body don't, aunt. As you can see, the Earth text field has the attribute name said toe user password. So I have to use that body. That you, sir fast. Worst password on basis. It we have just saved the information or the input from the user. So, um Okay, this is a way how we can a store they input from the user inside three different variables . Andi will have, uh, configured on a steamer on a schemer as well as a model on Well, basis it for this lesson. Guys, in the next lesson, I will continue working on this application so that you guys, I can understand how to a store information inside the batteries 31. NodeSaveInformation 6: Okay, guys, welcome back to another lesson off these video tutorial in this lesson. Off off the video tutorial, I will continue working on the application that that you says Mangala Devi in the produce lesson on you can see that we created three variables Onda Variables store. The include the user input. In other words, the variables store the information that the user passes to the server by using the HTML form. So, as you can see, we have three variables that a store, the the user name the email and password. Now what I want to Dewey's toe a store, all these information inside the database. In order to do it, I have to create what's known as a document. So I'm going to type in a comment that says creating a new documents on in order to create a document, we have to use our model. So in the prettiest lesson I created a model on the model is extort in a variable that is called custom model. So I'm going to use the model that was created in the previous lesson on I have toe create a documents. So it I've seen the variable new documents Andi. In order to create a new document, I have to use the model that was created in previous lessons in the previous lesson. Remember that the model is a start in the variable custom model. So I have to take being new who? Stone model. And now I have toe at properties toe the document that I am creating right now. Now, if I go back to the that the race, you can see that the documents inside the that that always have three properties. Actually, they have four properties, but we only have to pay attention to the three properties that, uh, well, each each off the each off the documents, CASS. Four properties. But we only have to pay attention. Toe three properties the property user name their property email on the property password. Now, what I want to do is to create a new document that has the properties, user name, email and passwords. So I have to type in your user name, which is the new property on the value of this property will be set toe the so the value of the valuable bar user name. Now I have to add another property that is the property email on the value of this property Email will be said toe the value off the variable bar Yusor email. And finally, I'm going to add another property. The property passwords on the value of this property will be said toe the value off the variable bar. Bad passwords. Now, as you can see, uh, we have created a new document. Now what I want to do is to store these documents inside the that without a raise. So I'm going to type in the next comment, saving documents document inside, in inside mongo vv on. In order to a store These documents inside manga TV. I have to take being the variable new document. And then that safe, Andi, I have to pass a function as a parameter Andi thes function will have two parameters as well. The first parameter is error in case something fails. When we are saving the information inside it at the race, then this parameter error will contain. I never message on the other perimeter east dock, which actually contains um, referenced toe the document that we have just created. So, uh, in this case, I'm just gonna I'm going to use only the first parameter the perimeter error on. Uh okay, let's let's typing Anethe statement. So I mean, Eve a roof. Remember that these if a statement will be used If, uh if the res are a mistake when we are trying to save information. So when we're trying to save the information to the database If something fails, then these Eva statement will be used. Now if something If something happens, If something wrong happens when we're trying to save the information to a lot of ways, then a massage will be sent to the console. Under moustache will be the error, but if everything works, fine. Uh then through the else statement or the else block will be used. Andi, If everything works, fine. Then what I want to do. East Toe sent our response to the So the saying What I want to do is to send a response to the browser that says, Ah, the information. Do you, sir? The new Yusor Waas Safed. Okay, They knew you, sir. Uh, in four, they knew user information. Okay. They knew you, sirs. Then you okay? The new user profile. The new user profile Waas Safed So As you can see, if something fails, a massage will be sent to the council. Uh, and then, uh, I know there. Another another message will be sent to the browser. So I think being response Thought sent everyone ah, when saving the information. So if something fails, this is the message that will be sent to the Web browser. But if everything works fine, then a massage will be sent to the council that says, uh, the information waas Safed on. Then a moustache will be sent to the browser as well. And the moustache says the new user profile Waas saved. Anyway, we have just finished our small application. So now it's time to toe test this application. So I have to go back to the council. But I have to stop my application. In order to stop my application. I have to press the keys control, see, in order to stop this application. So I have to press the keys controversy and now I have to restart the application, hoping that everything works well, works fine. I hope that everything works fine. A suspected Let's wait. Ah, some moments. Okay, guys. Well, as you can see, the massage success. The collection is working this place to the council, which means everything is working so far. No. Now what I have to do is to go to the Web browser, and I have to test this application, so I have to take being a user name. In this case, the user name will be Ah, Fundy Andi. Email will be on the Maraba a gmail dot com on the password will be one toe 345 Now what I want to do East toe. Add a new user to the database. So now I have to press the button, Save user and let's see what happens. So according toe, as you can see these Miss Ash this place to the browser on the moustache, says the new user profile Waas saved. Now, if I go back to the toe that race, you can see that so far I have three documents. But what I want to do is to refresh this information. So on the right side off the screen, there is a button that says Refresh again on the right side, on the right side, off the screen, the reset button that says refresh. So I have to press the button. Refresh on. Let's see what happens. Okay, If I scroll down this webpage, you can see that so far, I have four documents on if I analyze the the last document. If I analyzed the last document, you can say you can see that a new profile has bean saved inside the batteries. As you can see, we have the user name and the the email and the aroma. Gmail dot com on the password is going 2345 So our application is working. Now I have to go back to my application on I'm going to add a new user. So I take being the use. Earning will be Ah, Lisa. The email will be Lisa a robot. Gmail not come. And the passport will be 12345 nigh President don't save user on. This is the message that displaced to the browser the new user profile waas saved. Now, if I go back to the blue at the race, you can see that so far I have only four documents. But if I eyes grow the web page, you can see that on the right side. The reset button that says Refresh. So President will refresh on Let's see what happens now You can see s so far I have a five documents inside my database. On if I scroll down these weapons with base, you can see that at the bottom of the page. There is a new document on the document says user name Lisa E Mail. Lisa robert gmail dot com Password. 12345 Which means our application is able to save information inside the batteries. Well, guys, business it for these lessons in the next Listen, I will continue working with a mongo db. 32. MongoExerciseRead 7: welcome guys to another lesson off these big A tutorial. In this lesson, I will show you how toe read information from the batteries. So in order to show you how to read information from the database, I want to create a new application from scratch. So the first step to create a new application from scratch is to create on empty folder or the root folder. So, as you can see now, I have to be opened. I have the console here on the screen on the first step is to navigate to the stop off the computer. So I think being change directory these up. I know what I want to do is to create an empty folder. So I typing the comment, the comment I type in the comment Make view on the name of the root folder Will be, uh, Mongo exercise mongo exercise to now. Hit. Enter on. As you can see, I've just created a new empty folder. Now what I want to do is to navigate inside these empty folder. So I take being change directory mongo exercise to hit. Enter on. Now what? You can see I am inside the new empty folder. Now what I want to do is to create three practice Jason file. So I think being no package manner, you're in it. Hit. Enter on. Let's see what happens. Remember that the Packers Jason file is the file that contains a description off the application. Well, guy says you can see now I have to provide the backlash name. I'm gonna hit enter so that I can use the default option. The default value I hit Enter again. I have to provide a diversion. I'm gonna hit enter so that I can set the default value. Now I have to provide a description for the application. Under the scripture will be read information. Really? Information from the database from that base. Mongo db on his enters the entry point will be set to server the Js he entered. The key words will be mongoose mogul db on three on reading information. Okay. At the outer the after the outdoor will be my name, which is Raimundo. His enters on now it I mean guests and I heat enter one more time And now as that you can see I've just created the package is on file. No. What I have to do is to open my coat later on. I have to open the folder that I've just created on as you can as you know it before the resplendent in the the stuff off my computer. So I select the risk top off my computer, and I'm going to select the route fathers that I just created on the root folder says among go exercise to I said, like the father. And now, as you can see, a new a new window opens on this window displays the root folder as well as the packers. Jason, file Now what I have to do east to install some dependencies. So I go back to the console at and Bean, no package manner. You're in style. Double dash. Save the dependencies that I need our express to create the servers. Ah, yes. To create the HTML templates. Body parts, sir. Toe. Have access to the user input on um I also need mongoose Aunt, remember that bongos enables you toe have communication with that race. Now I heat enter on. Um let's see what happens. Well, guys, Now, as you can see, the Dependencies Cup already being installed inside the project now if I closed the console and if I look at the if I take a look So the package Jason, file. You can see that the dependencies appear in the package. Jason file body parts, sir. A year, years express and mangoes. Now, what I have to do is to create the the silver file. So I'm going to select the option you file. I'm going to save this file as server da genius. So I save this file as server dot Js not have to declare the dependencies the dependencies . Andi, I'd ignore the Constant Express on its value will be said to require express express. Now I have to declare another constant we can stand up on its value will be set toe the function express and I have to clear another constant. The constant bat on its value will be said to require pats. Andi, I have to declare another constant. The constant body parts, Sirs, Both the car search Andi. Its value will be set to require body parts body parts. Sirs on finally have to declare one more constant. I declare the constant mongoose on its valley will be set toe require Mongoose Onda. Well, I think, uh, I think this is it. I've just declared the dependencies that I need. Now I have to create a road on, I think means I have bean up Go to get on this road is going to send on html template to their web browser. So, um well, basically well again, thes road is going to send on HTML templates to the web browser. So the road will be ah slash find you, sir. These will be the road on now. I have to toe it specified the function that will be wrong for these routers. Now, I have to specify the commission that will be run for these road. So, uh, remember that this formation has two parameters. The first is request on the 2nd 1 Ease response on. Now, what I want to do is to send on html template to the web browser. So I take being response. Thought renders on the name off the HTML template that will be sent to the browser. Ease, find yusor dot a Yes. Now I have toe configure the deport. I think being up both listen. The port will be set to 3000 Andi. Now I have to declare a new function. Remember that dysfunction will be run. Will we run if everything works well, Works fine on the message will be listening at local host 3000. So if everything is working, working fine. These will. This is the message that will be sent to the console. Okay. Now what I have to do is to configure toe created the HTML template that will be sent to the web browser. So I have to create a new directory. The name the name of the directory will be abuse. I Now I have to create a new template inside these directory. So I select the option you find. Okay, you guys. Well, as I said, um, I have to configure. I have to create the HTML template that will be sent to the web browser on. Um, As you can see, I just created these new file, so I'm going to say thes file as, uh, find user, not a Yes. No, no. I save this file on that. You can see this will be the HTML template that will be sent to the Web browser on the title of this template Will be fined user on the's template will have a better with that that contains the text. Find you, sir, as well on. I'm going to configure and you have to create a form on this farm. Will use the boast method on the actual attribute where he said toe slash It's last shoot meat on. Uh, well, this these html form will have a single text field. So I have to create a barrel rap on the next field. Will have will be used toe typing the email off the user that we want to find. So I have to take being female. Andi, I have to create a text field like these on the name the attribute name, uh, for these text field will be user email. You, sir, Email. Now what? I want to do East Teoh to create a new return. So I think being I have to create a soft meat Bootle. So I asked the input The input back on the type Attribute will be set to submit on the theatric, the value attribute the attributes value will be set toe science user. Find Yusor now, as you can see, um what I want to do now East. What I'm doing here is that I am creating an HTML form so that when the yusor types in on email, we can find a juicer based on the email that WAAS introduced here. So what I want to do is to find users in the database according to the email. Okay, so we're going to find users inside that race by looking for the email. Okay, Now, what I want to do is to test this application. So I have to go back to the console. Andi, I have toe start the application, so it I'd be knows servant are not. Yes, I press enter and let's see what happens. Okay, guys, As you can see, everything appears to be working. But before I I test this application, I have to configure body part, sir. So I have to add a comment Configure body parts sirs on in order to configure what the parcel had to use Upset body person. So review engine. Sorry. Sorry. I have to configure the template engine, the template engine. So I type in the comment configure then plate engine. Andi, I have to configure the template engine a year. Yes, So I think being view engine on this option will be set toe area. Yes. Now I have to have another upset statement on. I have to declare the the directory have to specify the part toe the directory that contains the HTML templates. Andi, I have to use the constant your name on. Uh, now, I have to specify the folder that contains that contains the HTML templates on such further east abuse folder. So I, as you can see, I just configured a year. Yes. Well, guys, this is it for this lesson. In the next lesson, I will continue working on these, um, on this application that is going to read information from the batteries. 33. MongoReadExercise 8: Well, guys, welcome to another lesson of these video tutorial. Now, in this lesson, I will continue working on this application that reads information from the database. Now, as you can see in the previous lesson, I, uh coffee, earth. The template engine a judge's on. Now, what I want to do is to test this application to check whether all is working to check whether this application is working or not. So I have to go to the council on I have to start this application by running the d comment . No server DOJ. Yes, I hit. Enter on. Let's see what happens. Okay, as you can see the moustache listening at look and cost 3000 appears on the console. Now what I have to do, he's toe go to the Web browser. I'm going to open a new tough and I have to take being local coast. Local host 3000 is slash Ah, fine, it slash find yusor now hit Enter. And as you can see, the HTML form this place on the screen, which means my application is working so far. Now what I have to do is to go back to this application on but I want to do now is toe to make a connection to the database. So I have to type in a comment, make our connection. So the batteries he noted, to make a connection, I have to use the the the metal mongoose thought connect Andi, remember that these metals has two parameters. The first parameter is the connection string. On the second parameter is an object that has the option use new u. R l Parsons An X value will be said too true. No, What I have to do is to go back to Mongo db and I have to press table done connect. So I have to present Bootle Connect. But you can see a couple of Bootle connect I President, Don't connect on. Let's what happens. This is the window that this place now when I have to select the option, connect your application. I press the option. Connect your application on now. As you can see, the connection is strange. Appears here. Now I have to press the button. Copy. I have to press the copy. Well done, Andi. Now I have to President own clothes. This is it. I have my connection stream Now I go back to the application and based the connection String like this. Now I'm going to split my collection of strange into three pieces so that I have s so that I can see the whole connection is Drink on. Now, I have to replace three past work on, uh, the real password. Ease. Hello? Okay, this is the passport that I configured in previous lessons in the previous lesson, I configured a password on the password is the Hello password on. Now, if I go back to the database, if I press, they called the bottle collections Principato collections and let's see what happens. I, president of collections on. Let's let's see what happens. Okay, guys, after pressing the button collections, this is the webpage that this place hand. As you can see, we have a lot of ways profiles. So we're working with that arrays profiles. So I have to go back to the application and I have to remove test, and I have to take bean the database profiles like these on this is seat. My collection of string is ready. Now, what I have to do is tow confuse you configure the connection. Sweet baby Mongoose thought, uh, connection on a road. Remember that this is the function that will be run in case that three connection fails. If the connection fails, this is the function that will be run on dysfunction. Will display a message to the console on the message will display the error message. Now remember that this is the function that is run if the connection fails. But if the connections succeeds, then I have to configure another function if the collection succeeds. So this is the function that will be run. Even the collection succeeds. So if the connection succeeds, uh, a message will be sent to the console on the Miss Ash will be a success. So success connection, connection to move on TV. He's working. Okay, now what? I thought, what I want to do is to test whether this application is able to make a connection to the database or not. So I have to go back to the console and I have to stop my application. In order to stop my application, I have to press the keys control. See, this is very important to stop your application by pressing the keys control, see and Now I have to restart the application and let's see what happens. Okay, as you can see, a massage displaced. The console on the massage says success connection to Mongo DB is working, which means the collection is already working. So now what I want to do is to is to configure our model as well as in a scheme it. So I think, being a comment. Configure a schemer. It's schema on and model. Remember, that is schemers are description off the documents that will be safe inside the batteries. So I have to declare a new variable. The variable will be customers. Team custom schema custom is Kimmit on in order to create a new custom schema or any scheme it I have to use new mongoose duck. It's Cuba, Honest, I said. Skimmers are descriptions off the documents that are stored inside the batteries. So if I go back to the to the the ways you can see that we have four documents on each off . Those documents has four different properties. The first property Saidi. The second property is user name that the property is email on the fourth property is password, so I have to describe the properties, user name, email and password. All of those properties are off the DYP stream. So I have to describe, uh, the documents that are stored inside that a race. Such documents have three properties. Three such documents have three properties on the user name properties off the type of strength, the email property Ease off the type of string as well, and the password properties off the type of strange. So I have to go back to the application and I've been user name stream, uh, email, extreme E and fast worked DYP extremely. And this is it. I just I've just described the documents by creating any scheme it. Now I have to create a modern. So I have to declare on new variable, custom model Andi. In order to create a model I have to use Mongoose thought model on. I have to specify the collection where my documents will be a start. So the collection that I will be using toe story documents is the Loggins Collection. Remember that I have here the Loggins Collection. So this is the collection that I will be using to store my documents the Logan's collection . So I have to type in logging. Remember that you have to use the singular version off the name off the collection. So the name of the collection is Lovings. But we have to use the singular version off the name. So I have to use logging. Assad said You can see I removed the letters s so again you have to use the singular rail dissing the singular version off the name off the collection. So here I'm using logging without s. Now I have toe the specified the schemer. I remember that the schema is safe in the variable custom schema on Now what I have to do if I go back to the so the HTML template, you can see that the information will be sent to the server by using the post metals on the road slash soup meat. So I have to create a road that candles the input from the user. So they've been up the post on then I have to the Penis slash soup meat. These these the the road that will handle the game. The user input. Remember that this function has two parameters. Request our response on what I want to do now east to safe. Well, before I have access to the user input, I have to configure the body. Parsons. So, um, what I want to do now is to configurable the part, sir. So I think being equipment, go figure fully person body parts search. Remember that bully purser enables you toe handle the user input from the HTML forms. So, in orderto configurable, the parts that I have been at use body parts I thought you are l encoded on the option extended will be set to false on. Now I have to use another Abdus a statement again. Body person. I thought, Jason, Now you can see I just configured by the parson. Remember, the Ali Parsa is the dependency that enables you enables you to handle the user input from the HTML forms. Now, what I want to do is cause to create a new variable toe, a store, the email address. So they've been a comment store email address. I drink a little to say Alvarez. Okay. At store email address on If I go back to the HTML template, you can see that the text field has any allergies. His name equal to user email. So I have to declare a new variable that says via email, I have to declare a new variable cold bar email on its value will be set to request that body dot on If I go back to the growth to the HTML code, you can see that the attribute name has a value equal to user email. So I taping body that you, sir e mail. And this is it. I just saved the email address inside, uh, are variable on the variable east bar email. Well, this is it for these lesson. In the next lesson, I will continue working on this application, and I will show you how toe, um, How to read information from the batteries. 35. MongoUpdate 10: Well, guys, welcome back to another lesson off these video tutorial. In this lesson, I will show you how toe update information that is stored inside the batteries. So in order to show you how Taubate information that is stored inside the database, what I want to do is to create a new project from scratch. So the forces step. Uh, that I'm going that I'm going to take is to create is to navigate to the disk top off my computer. So I think being the comment change directory and then the stock. Now I have to create a new empty folder. So I have to use the comment, make their on the name of the new folder. The name of the new folder is, uh, bait. You, sir. In four. No, I Heat. Enter on. Now, what I have to do is to navigate inside these new survivor, this new directory in other, in order to navigate inside thes inside this new directory, I have to type being change directory on the name off the new folder which is date you, sir. In for now. I keep enter on. As you can see, I am inside the directory Now what I have to do is to create, um, Packers. Jason file. Remember that the Packers Jason file contains a description off the application In order to create the packages on file. I have to use this comment. No, Pashmina. You're in it. I think I hit. Enter on. Let's see what happens now. As you can see, I have to provide the package name I have by now. He enters to use the default version. I have to provide the version. Um, so I want to press enter so that I can use the default option. And now I have to provide a description. The description off this application will be they think they being information. It's torqued inside mongo DB. Now I hit. Enter the entry point will be set to serve her daughter. Yes, on daddy keywords will be Moose Moon Goose. Uh, mongo, db date. I hit. Enter the outer will be said toe my name, which is right window. And now I have to being just on basis it ideas created a new packers Jason file. OK, guys. Now what I have to do is to open the coach at night or on. They have to navigate toe the fault there that I just created. So remember that these funder is placed in the risk top off my computer. Now I am inside the stuff off my computers on. I have to select the before their plate user info. I select this folder. I know what you can see. Um, we have three root folder as well as the Pack A J. So file now, the next step is to install the dependencies that I need in order to install dependencies. I have to be no Turkish man. A year in style, double gosh save. And then, uh, express. Remember that this dependency is used to create the server, I guess, Is the template engine a body part? Sir Boyd sparser is the dependency that are hundreds. They input from the HTML forms on among goes I'll now hit. Enter on. Uh, the dependencies will be installed inside my project. Of course, this process takes a while, so I have to escape this part of the process. OK, guys. Now, as you can see, the dependencies that I need have already being InStyle's inside the project. Now, if I go back to the coast tonight. Or you can see that the Packers, Jason, this place, the dependencies that have already being installed on know what I have to do is to create a new file on the name of this file. Well, this file will be saved. US server Dodger. Guess I hit. Enter on now. The first step is to the clearly dependencies the pen Quincy's early have to the clergy. Constant express on its value will be set to require express. I know I have to be clearly constant up on its value will be set to the foods shown express not have to. The clearly constant bat on its value will be said to require Pat. Now I have to declare the constant bully partners on its value will be set to require body parts. Now I have toe declare another constant move whose its value will be set to require mongrels on. Well, I guess this is it. MMC. Yes, I guess it is it. Now I have to create my roads. Andi, I have to create the first road on the first perimeter will be said toe slash They use, sir, on the second parameter will be a function on this form shown Casto parameters. The first parameter is request on the second parameter ease response on What I want to do now is to send an HTML template to the Web browser. So I have to type in response to render on the name of the template that I want that I want to send to the web browser. In this case name the name of the template will be bait. Use search dot A Yes, off course. I have not, uh, creative, they template yet. But what? I will create it later. And I have to set up the port. So they beat up that listen on. Deport will be set to 3000. And now I have to create the function that will run If everything is working fine on demand on dysfunction will display a message to the Council on the message will be listening at local coast 3000. Okay, now what I have to do is to create the template who played yusor dot a year. Yes, Andi. Well, before creating the template, I have to configure a year. Yes. So I have to add a comment. Go figure. Yes, I have to use up. That's it. The option view engine will be set toe a year. Yes, on the option. Uh, the option abuse will be said toe the pat toe, the directory that stores the HTML templates. So in order to specify the path to the directory that stores the HTML templates, I have to use the minutos pat thought Join on the constant your name. Remember that this constant your name stores the path toe the root directory on then have to specify the folder that contains the HTML templates. Now you can see I just configure a Yeah, I guess now I have to do is to create the folder. And the folder on the name of this father will be abuse. And now I have to create the template the user dot a Yes. So I select the option new for new file. I'm going to save this file as who made you, sir, Does a Yes, I hit Enter. But this is it. This is my HTML template. Now I have to add some mark up to these html template on the title. For this template will be bait. Who they use her name. They use her name on and huh Password on the's template will have a better one on the other one. Time will be update they you certainly fast work now This template will contain a form on these form Is going to use the post methods to say the information to the server on the action Attribute will be set to a slash soup meat now thes form will have three paragraphs like this on a soft meat Bhutan on the attribute value off this button will be set to date . Okay, now the first paragraph will be used toe input The email address The second planet rap will be used to input The new user name on the third paragraph will be used toe input The new password on Now I have to ask three text fields like this on the attribute name for the first text field will be set toe yusor e mail. Now I have to ask another fixed field on theatric. Yout name for these text field will be set to use earning you, sir Name on. Finally I have toe one more fixed field on the actually it name for these text field will be set toe uh, you, sir Bass. Worst on this is it? I just finished my template on. Well, what I have to do now is to to test whether this application is working or not. So I have to go back to the council on I'm going toe. I'm going to run this application backup. But I'd be no server dog. Yes, he entered on. Let's see what happens. Okay, s so far, everything appears toe be working now. Uh, I have to go to the web browser. Uh, we have to take being, ah, local host 3000 slash who they user now heat Inter's. But as you can see, the HTML farm, this place, which means everything is working so far. Ah. Well, this is it for this lesson on. In the next lesson, I will continue working on this application that updates information that is stored inside manga TV 36. MongoUpdate 11: Well, guys, welcome to another lesson of these video tutorial in this lesson. I will continue working on the application that day. It's information, Um, from that I will continue working on the application that operates information that he's distort inside manga TV. I'm well, now the next step that I have to take. He's too, um is to create to make a connection to the database. So in order to make a connection, I have to add a comment that says, Ah, connection connection to mongo db Now, in order to connect in order to make a connection toe today a lot of ways I have to use the methods Mongoose thought connect on. Remember that these methods requires two parameters. The first parameter is the connection. Strange on the second parameter is a non option that says that is use new u R l parcel on. I'm going to set this option to true. No, What I have to do is to get the connection string. Well, well, what I want what I have to do now is to get the connection string. So I have to go back to Mongo. Db Onda. As you can see, I am now in mongo DB On now, what I have to do is to press the Bhutan connect, so I have to press the button. Connect. Let's see what happens. Okay? After pressing the button, connect. This is the window that this place. Now I have to select the second option. The option that says connect your application. Andi, thesis it now. I have access to the connection between No, I have to press the button. Copy Andi. After pressing the button, copy. I have to press the Bhutan close on. This is it. I found my connection is strange. My connection is training. Now on now I have to paste the connection. Strange Aunt, I'm going to split. This connection is strange into three pieces like this on this is it? I have the connection is strange. No, I have to specify the password. Remember that the passport is hello. In my case, Andi. Well, now, if I go back to mongo db on If I pressed the Bhutan collections collections, let's see what happens. Okay. After pressing the brutal collections this easy with page that this place on, remember that I created a database profiles that you can see, I have faith that the race profiles on the other These profiles easy. That are ways I am working with Right now I am using be that I miss profiles. So I have to go back to the coath on remove taste hand. I mean, ah, profiles profiles on this is it. And now what I have to do is to confuse, to continue working in the manga division mongo db connection. So I have to use mongoose dot ah, connection that bone on a roof. So if something fails, if something goes wrong, this is the the function that will be run on Well, basically, dysfunction will display a message to the council. On the message will be the error message. So if something faded, something fails. While if something fails with the connection, then this is the function that will be used. But it's if the collection succeed, succeeds then. Ah, these Easton metals that will be used. Ah, again, I have to specify the function that will be used If the collection succeeds on If the collections would succeeds, amend a massage will be sent to the console on the message will be so success the connection to mongo. DB works. Okay, Now you can see I just configured two functions. The functions there, the first function will be used will be used if something fails on the second function will be used if the connection is working. Okay. Now what I have to do is to go back to the council and I want to go. I want to stop this application by pressing the keys controversy. I'm now I have to start the application. Andi, let's see what happens. Well, as you can see, a massage this place to the console that says the connection is to mongo DB works, which means my collection is working so far. Andi Now what I have to do is to configure a model as well as a schemer. So I have to add a comment. Go Figure model on a schemer is Kema Onda. Remember that in order to create and a schemer, I have to the clear a new variable on the variable will be coast on a schemer on, I have to create thes variable custom schema. This variable will contain the schema on in order to create a new scheme. And I have to use new mongoose dot Ah, Schema. I don't remember that a skimmers are descriptions off the documents that are stored inside the batteries. So if I go back to mongo db, we can see that the documents have 3/2 way. Well, if I go back to Mongo db, you can see that the documents half for properties. I've the user name, email and password. I have to describe the properties, user name, email and password. So I have to describe those properties inside Theus, Schemer on a so you can see the property use of Remy's off the type of strange the property email is off the type of strange as well on the property. Password is off the type of strange. So I have to go back to my schema when they have to take keen user name type extreme, uh, email type screen on passwords like a strange and this is seat. I've just created my schema. Now what I have to do is to create a model, so I have to create to declare and you variable just a mother coastal model on I'm. In order to create a model, I have to use tomatoes. Mongo start model. Remember that the model is specifies the collection where the documents will be a start. In this case, the documents are stored in the collection. Loggins, As you can see, the collection Loggins Easy collection that we are using to store the documents. So I have to specify looking. It's it's very important to realize well, one important one important consideration is that here I am using logging on, remember that logging is the singular version off the world. Loggins. So in the member will be the collection name is Loggins, but are here in the coat. I'm using logging without s. So you have to use the singular version off the name off the collection. Okay, Without s. And now I have to specify the schemer. So I have to specify the variable custom schema. This is it. I've just created the model, the schemer, the that of his collection. Andi. Well, I think. And if I go back to the so the template, you can see that the information he's sent to the server by using Ah, the post metals on information is sent to the server toe the road a slash soup meat. So I have toe create a new road, that candle supposed requesters. So I have to take up the post on down the road, which is a slash soup meat. Now I have to specify the function that will handle the user input on this phone. Sure, we have two parameters. Request and response. Uh uh, Well, before I have access to the user input, I have to compete your body part, sir. So I have to add a comment that says a configure body parts surf. Remember the early part sarees dependency that enables you toe handle the user input from the HTML forms on in order to configure your body parts that I have to you being body parts , sir, Don't. You're el in cold. It called it in college. Sorry. On the option extended will be set to true on. I have to use another at the use of statement. I have to use body parcel as well, though to Jason on This is it. I've just configurable the purser as well on um Well, okay. I think this See, I think this is it for this lesson. Now, in the next lesson, I will continue working on this application that Bates information that is stored inside mongo db 37. MongoUpdate 12: Well, guys, welcome back to another lesson of these video tutorial in this lesson. I will continue working on the application that updates information inside the mongo DB mongo db. That raise on. Well, and now what I have to do is to work with the road that handles Post Request This. So, uh, you guys you know it, um we have the HTML template that is going to send information to the server. Andi Thes road is responsible for, uh, for getting the information, the user input and then, um, populating the information inside the batteries. Well, the people state that I want to take now he's to save the user input inside three different variables. So I'm going to declare three different variables. I have to add a comment that says, Ah, saving user input. And I have to declare a variable bar use by Bosch email, and its value will be said toe request that body dot on if I go back to the HTML template, you can see that the first text field castle attribute name said to user email. So I had to use request that body that you, sir, email. And now I have toe to declare another valuable the valuable will be barred user name on its value will be said to request the body That And if I go back to the HTML template, you can see that the second text field has an attribute name equal to use her name. So I have to take being body that you certainly. And again I have to create another valuable bar past worked on these variable will be said to body requests that body dot on If I go back to the template, you can see that the Earth text field has an attribute. Name equals equals toe equal to user passwords. So I have to use that body, Don't you, sir? Fast work. You surf pass work and this is it. Now I have saved the user input inside three different variables. Okay, now what? I have to do East toe update information inside it at a race. So I have to add a comment, I hope. Date information. Well, guys. Well, in orderto oblate, the information I have to use three model. So if I scroll up, you can see that the model is stored in a valuable custom model. So I have to use the variable custom model. Andi, I have to take mean course model the date, aunt. Now thes function. These methods sorry requires one parameter the first parameter for these methods. Um, he's used to find a given document inside the that always. So these first parameter specifies the document that we weren't toe date. Okay, so these parameter is used, so find a given document inside the batteries, and at the same time, we this perimeter enables you toe a specify the document that you want Taubate. So in this case, I want to update a document whose property email equals the variable bar email on, uh, after the second parameter specifies the new values for the document. In other words, the second parameter is specifies the new, uh, the information that will be updated or the changes that will be made toe the document. So the second parameter is specifies the properties that will be elevated. These parameters specifies the new values. Well, now the new values will be user name on the user name. Property will be set toe the variable bar user name on the property. Uh, passwords will be set to the variable bar. Fast work Andi After the group date has taken. After awaiting the information, we have to specify the callback function. These callback function has two parameters. One perimeter East Aurora. In the case that something fails, this parameter error will contain an ever message and the other perimeter east response V cycle perimeter contains information about the documents that were dated. So uh, no, If something goes wrong Onda, we cannot update the information, then thes if a statement will be used on the's, if a statement, we'll send a message to the console that displays the error moustache. Andi, we're going to send a response to the browser that says they're worse. A program. My a problem. A court. Sorry. Sorry. Ah, problems When Who They being the information? Okay, problems when relating the information. So if something goes round and we cannot elevate the information, this is the message that will be sent to the browser. No, um, in the case that we cannot modify any document. For instance, if we cannot find a document which can be dated, then these second if a statement will be used, these give a statement will be used even the information cannot be dated because the document, um waas was not found. So if they document that we weren't toe date cannot be found, then these if a statement will be used on way, have to die peen eve responds boat and modified equals zero. In other words, if if not in west money five then a message will display to the console and the message will be be the yusor cannot be found on. Uh, if the user cannot be found inside the if the user cannot cannot be found inside the that always Then a message will be sent back to the web browser. On the message will be, Ah, the user profile profile. You cannot be found. Okay, Now, if everything goes, if everything works fine on me If they If if we were able to obey the information successfully, then these if a statement will be used. So I think being eve response thought in multi five his fatherland zero. Which means if they if they if the information was updated successfully, then a massage will be sent back to the council from the message will be the information waas they did on if the information is updated successfully, then, uh um, a moustache will be sent to the toe. The browser on the miss. Such will be the user profile, bro. File waas. They did. Okay, so this is it. I've just finished my application. But what I want to do now is to test this application to verify whether this application is working or not. So, um okay, what I want to do is to go back to the council. I have to stop the application by pressing the keys controversy. I now have to restart the application on. Let's see what happens. OK, guys, Now what I want to do is to test whether my application is working or not. Okay, guys. Well, in order to test whether my application is working or not, I have to go back to the mongo db mongo db Atlas on. If you pay attention, toe the documents that display on the rouser. You can see that I have are a document that across a user name equals toe Raimundo on email . Equal toe. Hello. Arrive at gmail dot com and a passport equal to 12345 So what I want to do Now he's to update these user profile. I want to update these user information The user name Raymundo on. Well, in orderto date, these user name the user. In order to bait the use of Raymundo, I have toe go back to my application on I specify the email address. Hello. Arrive at gmail dot com. The new user name will be right. Mondo the You know the new user name will be Raimundo. Ah, Raimundo Sanchez will be there in the new user name on, uh, the new password will be 123456789 I think now, if I pressed the button update, let's see what happens. Well, this dismiss ash this place. The moustache says the user profile was updated. Now, if I go back to the toe the database on, if I scroll up, you can see that the reset button that says refresh. So now I have to press the button. Refresh on. Let's see what happens. Okay. After pressing the button, refresh. Let's scroll down. And as you can see, the user right, Mondo has been updated. Now the user name is Raimundo Sanchez on the passport is 123456789 10. Now what I want to do is to modify the You certainly call. So I have a user name. I have a user. Nicole, whose female address is Nicola Rahim. A lot. Come on. Who's passed? What is 12345 Now what I want to do is to operate the user, Nicole. So I have to go back to my application on I have toe modify the email address to Nicole on the new The new user name will be a Nicole Natalie. No, will. We didn't. Then you use her name on the new password. Will be, uh 2020 2020 20. Now, I principal toe date on things is the message that this place, the user profile was updated. Now, if I go back to the database and scroll up, you can see that there is a button that says Refresh. I praise the Bootle. Refresh on. Let's see what happens. Let's see what happens. Okay. After pressing the button, refresh. You can see that the user name has bean related to Nicole. Natalie. No. The password has been updated to 2020 2020 20 which means my application is working on, which means my application is able toe date information that is stored inside Mongo db. Well, now you know how toe date information by using a mongoose on a mongo db. 38. MongDelete 13: welcome guys to another lesson off these video tutorial. In this lesson, I will show you how you can relate information from the batteries. So in order to delete information from the batteries Ah, in order to show you how to how you can delete in formation database, what I want to do is to create a new with application from scratch. So the first step will be to navigate to the desktop. So I take being change directory, these top hit enter. And now what I have to do is to create a new empty folder. So I have to use the comment, Maybe Auntie name off the off The empty folder will be the lead mongo db. I know a heat index. Now, what I have to do is to navigate inside these new empty folder. So they being change directory the lead mongo db now hit Enter. And this is it. As you can see, a young inside the new directory. I know what I have to do is to create a backer Jason file. So I have to use the comment npm in it. Now I hit enter and let's see what happens. OK, guys, now As you can see, a North package manner. Your is asking me to provide a backlash name. Now I have to press, enter or hit enter so that the default option is used. Now I have to provide the version. So I heat entered so that the default option is used as well. And now I have to provide a description. And the description will be learning toe elite information from Mongo DB And now you keep inter. Now the entry point will be set to server Dog Yes. Hit Enter enters Dickie Words with the moose. Ah Mangala Devi on delete it entered The outer will be set to my name which is right noodle on. Now I have to take being yes on this is it. I have years creative a new package. Jason, file. Now I have to go back to the Coast Writer and I have to open the folder that I have just created. Ondas You guys, you know it before there is located in there, The stuff off my computer. So I select the risk tops And now I have to select the new empty folders. So then select I select the folder delete delete mongo db I select this folder. Now, as you can see, a new window opens. Window contains the packers Jason file. Now what I have to do is to install the dependencies. So I have to be no package man a year in style. Double That's safe. Express. Remember that expresses usedto create the server now You? Yes. Is the template engine body person enables you toe handle the user input from the HTML forms on finally mangoes which enabled you enables judo Use the batteries now hit. Enter on. As you can see, dependencies will be installed inside my project. Of course, this process takes a while, so I have to skip this part of the process. Now you can see the dependencies have already being installed inside my project. Now, if I closed the console, you can see that the Packers Jason file contains a least off the dependencies that have already being installed inside my project. Body parts, er, years express and mangoes. Now, what I have to do is to create a new file on these new file will be called, uh, several O J yes, server, don't you? Yes, I hit. Enter. I know What I have to do is to declare the dependencies so I have the clearly constant express express on its value will be set to require express. Now I have to declare another constant up on its value will be said to the Function express and I have to declare the constant it. But on its value will be said toe require. But now I have to declare another constant. The constant mongoose on its value will be set to require mongoose Mongoose on and I have to declare one more constant body person on its value will be said toe require body parts ish body Marsters And now what I have to do is to start creating my first road. So I I add a comment Roads on the first road will be a road that handles get request ist on the road would be a slash the lead you search And now I have to create the function that will be run when the user be seats they given you are l on dysfunction has two parameters the perimeter request any parameter response on what I want to do when a the user B c It's the address local Khowst 3000 slash delete user. What I want to happen when the user visits such you are l address. He's that at template will be sent to the web browser. On the name of the template will be the lead. You, sir. Don't. A year? Yes. Now I have to go for your report. They'd be in port on. Ah, the board will be set to 3000 on. I have to ask the function that will be run if everything works fine on the moustache that will be sent to the browser. If everything works, works fine. He's a message listening at local host 3000. Okay, now when I got to do is to configure three template engine. So I have to add a comment, then played engine Andi, I have to use up photo set at that set on the option view engine will be said toe. Ah, yes. On the option, abuse will be set toe the bat well at the option. Abuse will contain on the path to the directory that contains the templates. So in order to specify the directory that contains the templates in order to specify the pat toe, the directory that contains the templates. I have to use the method. Join on the constant were name. Remember that this constant their name contains the path to the root directory and then the Views folder or the Abuse Directory. I have to specify interviews Directory, which is the directory that contains the HTML templates. Now I have to create such directory. So I select new folder on the name of the directory will be abused on now inside these views Sublime Soup Directory I have to create a new file on the name of this file will be said toe the lead user dot a year Yes, hit, enter And now these template will contain HTML Koth. Now the title of this template will be the lead Yusor and ah, this template will have our killer want that. That says the lead yusor as well on the's template, will contain a form Andi form will use the post metals on the action. Attribute will be set to a slash soup meat. Andi. Well, these form will contain a paragraph and this paragraph will be used to import toe input. This paragraph we contain a text field on these text field will be juiced toe input, The email address. Okay, so this text field will be used to input the email address. So the attribute name will be set toe yusor email on. I'm going to us email inside the battery up. And finally, um, I have toe, um, as a asked me to Bhutan on the attribute value off these Bhutan will be said toe the elite . You said on the seat ideas creative. Uh, the HTM inform that we that will be used toe elite users from the batteries on. Well, you know, what I have to do is to test this application to check whether this application is working or not. So I have to go back to the council on Grundy. And I have to start this application by ruining d comment. No server. Dodgy. Yes. Hit. Enter. Let's see what happens. Okay. As you can see, everything appears to be working. So, uh, now I have to go back to the to the web browser and I have to They bean local host 3000 eyes lash it slash the lead users now hit. Enter Andi. As you can see, the new thing the HTML form this place. So s so far. Everything appears to be working. Um okay. I know what I have to do is to go feed your body purser. So I have to type in a comment Configured body parts. If Andi I have to use the app that uses statement, then body parcel dot You are ill and in cold it on the option will be it will be extended hicks. Then death on this option will be set to false. And finally, I'm going to use another apple, a juice statement, and I'm going to ask the body person the nasal and as you can see. But, boy, Parsa half has already being configured. Well, I think this is it for these. This is it for this lesson. In the next lesson, I will continue working on this application that the leads, um, users from the batteries 39. MongoDelete 14: Well, guys, welcome to another lesson off these via Vitoria In these lesson, I will I will continue working on the application that deletes information from the database. Well, now, as you know it, we have created a template that this place, ah, form that this place and HTML form to the Web browser and thes thes HTML firm contains a text field on such text field will be used to serve meat toe input. Sorry, The text field will be used toe import toe input, the email address. So while what I want to do now is to get the email address. So if you analyze theater plate, you can see that the information is sent to the server using the post metal on the information is sent to the server toe the address slash soup meat. So I have to create a road that handles the user input. So I take bean up the post on the um the road will be a slash soup meat. And now what I have to do is to create the function that will handle the user input. So it and this is a function. Bix Dysfunction has two parameters request and response on what I want to do now. East. To save the email address inside a variable so help toe add a comment safe email address. Safe email address on. In order to save the email address, I have to create a new variable. Uh, that is called bar email on the value that will be set to these variable. He's a request dot body. Remember that the property request the body is on object. Well, Harry request that body is an object that contains the information from the HTML forms. Well, now, if I go back to the template, you can see that the attribute name he said to you, sir. Email. So I have bean that user email, and now I have saved the email address inside the variable bar email. Now, what I want to do is to delete the lead users from the batteries. What I want to do is to the need a user from the batteries on, and, um Well, before I continue working on this, what I have to do is to make a connection toe the so that the race. So I have to add a comment a that Greece that the race connection on Remember, remember that if we want to make a connection, we have to use them. Tomatoes, Mongoose, start connect on These method requires two parameters. The first parameter is the connection is training, and the second parameter is an option that he's use. New U R L Our search on its value will be set to troop. Now what I have to do is look, it's I have to get the collection of strange. So I have to go back to Mongo db on I have to press the button connect. So I got to press. They will Don't connect on. Let's see what happens after pressing the button connected. This is the window that this place Now I have to select the second option connected your application Earth. Now I have access to the connection string, so I have to click. They do. I have to press the button. Copy Andi. After pressing, they don't copy. I have to president on clothes on. Now I have my connection is drink? No, I paced the connection string here on again. I have to split this connection strange into three pieces for real ability on now I have to specify the pass worked. The password is hello. And remember that now we're working. Well, remember that we are working with the database profiles. So I removed taste Andi place profiles. This is the number. The name of the batteries. The that of these profiles on this is it. Now what I have to do is tow. Specify the function that will be used if the connection fails. Have to tie teen Mongoose start connection dot own and then a road if there is a failure If something if something goes wrong When, uh when we are making the connection what I want to do is to display May such to the council on the massage will be the error message. But if everything works on the connection succeeds then I want to use these other function on the function will display a message to the gold So on the message will be a success. Super cess! The connection to mongo DB works Okay. Now, as you can see, I have toe have configured to two functions One function is used If the connection fails on the other function is use if the connection succeeds Now. When I got What I want to do is to test this application. So I have to go back to the council. I have to stop this application by pressing the keys controversy. And now we have to restore the application and let's see what happens. Okay. Now, as you can see, the connection to the database is working. Atyou can see a a massage, this place today console. And the message says the connection to mongo DB works, which means my connection to the database is working, working fine on. And, uh, now what I have to do is to configure your, uh, on a schemer as well as a modern. So I have to add a comment for figure schemer more than I can remember that schemers are description off the documents that are stored inside the that always. So I have to go back to mongo db. I remember that, um, the documents inside the database have four properties. One property is three ivy property. The other property is user name, email and passport. The property user name is off the type of strange. The property email is off the type of strange and the property password is off The type A strange. So I have to describe such three properties in the schema. So I have to create a new screen on us Schemer. So being let Cousteau schemer. And in order to create an Eskimo, I have to use new mongoose Schemer on. Now I have to describe the documents that I was so that I have to describe the documents that are found inside the that the race. So I take the user name diaper stream E mail type a strange and password type A strength and we see that I've just described on the I've just thes grave the HTML. Uh, I'm sorry. I've just described the documents. Now I have to. Okay, now I have to create a model. So I think bean let custom model postal model on in order to create a model like a teen. Mom goes, don't model on the first parameter will be three collection where my doctor documents are stored In this case, my documents are a start in the Loggins collection. So I have to type in looking remember that I have to specify the name of the collection without s pieces were important. I have to specify the number the name of the have to specify the name off the collection without s. This is very important. I now have to specify idea Schemer. So they being custom schema And this is it I've just created and a schemer as well as a model on I have to go to the to the road that candles, the user input and what I have to do is to use the remodel. Remember that the model is a start in the variable custom model, so I have to use such model. But they being custom model that the elite one And now, uh, the first parameter s specifies the document that I want to delete. So in this case, I want to delete a document whose property email he was bart email again on the first parameter. It specifies the document that I went to the elite. In this case, I want to delete a document whose property email equals the value off the variable bar email. And after that, I have to specify the callback function. These callback phone xun, uh, cast two parameters. Well, thes callback function has a single parameter. Sorry. On the perimeter is an error message. So if something goes wrong, the's first if a statement will be used. So if something goes wrong, uh, I never miss Ash will be this place to the council on, uh, the next Miss Ash will be sent to the web browser. Search a roof. Ah, the yusor cannot be the deleted. The late cannot cannot be removed. Okay, But if everything works fine on if the user he's removed from the race, then thes else statement will be used. And, um, Onda massage will be sent to the console. A massage will display to the council on the message will be a success. Uh, you, sir, You, sir. Waas removed Andi Well, a moustache will be sent back today with browser. So I take being response taught since and the missiles will be success The Yusor west removed on this is it I've just created Ah, this I've just finished thes small application on Dwell This is it for these lesson. In the next lesson, I will test this application on Well, I will check whether this application works or not. So in the next lesson, I will continue working on this application 40. MongoDelete 15: Welcome back, toe Another lesson off these video tutorials. Well, in these less and I will continue working on the application that leads users from the database. Andi. Well, in the previous listen, I finished creating the application, but now I will test this application so that I can verify whether these application works or not. So what I want to do now is to test this application to check whether this application works or not. So a what I have to do now is to go to the council on day. I went to a stop this application. So in orderto stop this application, I have to press the keys control. See, after pressing the keys controversy, I have to restart the application. Um, then I can, uh, faced the application. Well, guys, now, as you can see, the application appears to be working. Now I have to go to the Web browser Onda. Uh, if we analyzed the video lottery's, you can see that I have five different users inside that directories the first user East. Raimundo Sanchez. The second user is Michael. The user is Andy. The fourth juicer is Lisa on the fifth user East. Nicole Nicolino. So what I want to know East toe Remove to remove to users from the from the database. So in order to remove to users from directories, Um, what what I have to do is to go to the application, and I have to input the email address. So, as I said, I have to input the email address in order to remove a user from the batteries. So in this case, what I want to do is to remove the user, Nicoleta Lino and the use of record metal on the user. Nicola Molino has the email address. Nicole araba gmail dot com So I'm going to take being the email address. Nicole a robot gmail dot com And now I have to press the button. Delete user. Let's see what happens. Well, as you can see a message this place to the browser that says Success, the user was removed. So if I go back to the one body bean, I have to scroll up the webpage on. I have to press label tone refresh, so I have to press the button. Refresh and let's see what happens. Okay, After pressing the button, refresh. You can see that there there are only for users on. We have the user Raymundo, the user. Michael the user, Andy on the user. Lisa. But the user, Nicole, has already being removed from the database. So now what I want to do is to remove the user. Lisa. So the user Lisa has the email address. Lisa. A robot. Gmail dot com. So I have to remove the user Lisa on. They have to go back to the application, and I'm going to take being, uh, Lisa araba gmail dot com Now I pressed the button delete user. Well, as you can see, this is the message that this place success the user was removed. So if I go back to their to the browser, I have to scroll up the webpage. And now I have to press that you don't refresh, earn. Let's see what happens. Okay. After pressing the Bhutan refresh, you can see that I have the user Raymundo Sanchez and the on Michael. But the user Lisa has already being removed from the batteries so you can see this application is working. And, uh, well, now you know how to removed users from the batteries you seen a moose as well as Mangala Devi. Now you know how to remove information from the database you seen Mongoose and Mongo db? 41. Login 16: welcome guys to another lesson off these video tutorials. In this lesson, I will create a logging system. Eso. In order to create our logging system, I will have to use sessions as well as mongo db. So, um Well, in order to create a logging system, I will used sessions sexual rebels as well as mongo db on. Well, what I want to do is to create a new project from scratch. So, um, have toe have I have to go to the council on the first step is to go to the desktop, so I have to take in the comment. Change directory these stop hit. Enter on. Now, what I want to do east to create an empty father, suck up to use the comment, make their and, um, the empty folder will be called looking system logging system. Now heat enters. I know what I have to do is to navigate inside the Logan System directory, so I have to use the comment. Change directory looking system. Now I keep enter on. As you can see now I am inside the logging system directory. Now what I have to do is to create a packers, Jason file. So I have to use the comment. No package manner. Your feet. I know. I hit. Enter on. Let's see what happens. Remember that the Packers Jason file is a file that contains a description off the application as well as at least for us, as well as the least off dependencies that are required for the application toe work. Well, now I have to provide the package name. So I hit Enter so that I used the default option Now have to provide the version I hit enter to use the default option. Now, the description will be logging system. You seem, uh, Logan System. You seen mongo? Db Island Citian variables say Xun variables. Variables. Okay, now heat enters the entry point will be set to server Dodger. Yes, he didn't There. The key words will be a mongo db physicians aunt. Logging on the outer will be set to Raimundo, which is my name. I don't know what I mean. Yes, and this is C type has created a new pack, a Jason file and I have to go to the Cody writer and I have to open these folder that I just created. Remember that the father is placed in the disk top off my computer. Andi. Now I have to select lead up the new, so they have to select the news directory that I created on. As you can see, any window opens on this window. Contains the packers, Jason, file. Andi. Now what I have to do is go back to the council on I have to install the dependencies that I need. So I had to be no package money here. Installed double dash, save express. Your yes, fully person on mongrels on. Um but this is it. Now a heat inter on a day. You can see this will be the dependencies that I will installed inside my project. So I This process takes a while, so I have to skip this part off the process. Well, now, as you can see, the Dependencies cup already being installed inside the project on um, Now, if I go back to the packers, Jason filed, You can see that the dependencies appear here, buddy. Parsa? Yes. Expressing mongrels. We'll know. Where I got to do is to create the main file. Remember that the main file East Server server DOJ. Yes, I hit interest on now. What I have to do is to define the dependencies or to the clearly dependencies. Now what I have to do is to declare a constant the constant express okay on its money will be set, require express on, have to declare the constant up on its value will be said toe the Function express. And now I have to declare the constant but on its value will be set to require But no, I have to. The clearly constant a moose mongoose on its value will be set to require moguls on Finally , I have to declare the constant body person on its value will be set to require Ah, body Boxfish, NBC Seat I've just the the dependencies that I need s so far, Andi. Now what I want to do is do create my first road. So I at a comment roads on the's first road we'll display on HTML template today with browsers on the road will be slash logging on. Then I have toe create the function. Remember that this friendship has two parameters. Request that response, Andi. Finally, I'm going to send an HTML template to the Web browser so have they been response that renders on the name of the HTML template that I want to send for the browser on the template will be logging dot here. Yes. Now I have to configure the port Good earned. The port will be said Toe 3000. And now I have to create the function that will be run If everything works fine on dysfunction will display a moustache to the console that says listening at local host 3000 . Okay, now what I have to do is to configure Yes. I had a comment. Who figure a year? Yes. And to configure a years I have to use up. That's it. View engine. The option viewing in will be set to a year. Yes, on another option. Another other statement upload set. The abuse option will be said toe will remember. Remember that this option contains the path to the directory that contains the HTML templates. So in order to specify the path to the directory that contains the templates, I have to use the middle part thought join Now you see constant your name. Remember that the constant dear name contains the path toe the directory that contains the HTML templates. And now I have to specify the directory that contains the HTML templates on Dwell. Now what I have to do is to create such a directory on I have to create a new template inside the abuse. A directory I have to create a new template inside. Reviews directory on the's template will be safe. Saved us logging a Yes. On on now. What I have to do is tow tow Athey html Coast. The title will be set to logging on thes pace Will have ah, Heather one back that contains the text log in as well. And I'm going to add a form on this farm is going to use the post method to send information to the web browser. I'm the action that we would attribute will be said toe a slash Ah, looking as well. Now this form will contain two paragraphs on a single on day activites name. They attribute value for these Wootton will be said. Sorry, guys. Well, theater tribute value will be said toe looking on the seat. Now what? I have to be the first, um, now, uh, the first paragraph. It will contain a text field on the attribute name will be set to you to use her name. So reuse her email. You, sir, email on the second paragraph and the first paragraph will contain the text user name. Sorry. Email on the second paragraph will contain the text. Passport past work on it will contain another text field on the attribute name off these text field will be set toe yusor bass work. Andi, Um, I think this is it. We have just finished the okay. I have to change the attributes type. I have to change the type. Attribute off the second text field on the type Attribute will be set to passwords fast work on. This is it. I think I've just finished my HTML template. Now what I have to do is to test this application to check whether this is working or not. So I go back to the council and they'd be no server. Dodgy. Yes. Hit. Enter on. Let's see what happens. Okay, I miss such displaced The console that says listening at local cost 3000. So everything appears to be working now I have to go back to the so the Web browser and they mean local host 3000 slash looking I heat enter. Well, this is it. My logging, uh, form appears on the screen. So I think this is it for these lesson. In the next lesson, I will continue working on this application that creates our logging system. 42. Login 17: Well, guys, welcome back, toe. Another lesson off these video tutorial In this lesson, I will continue working on the application that creates a loving system by using a mongo DB as well as variable a session variables. Four sessions. So well, now the next step that I want to take is to make a connection to the database. So I have to add a comment. The connection to Mongo DB now, in order to make a connection, have to use the mongoose start connect Meadows Onda Thes metal requires two parameters. The first parameter easy connection is training on the second parameter is an option. Use new u R l sparser on this option will be set to troop on. Now what I need Easy connection. Strange. So I have to go back to the so the batteries. Andi have to press the Bhutan connect, so I have to press the button. Connect Andi. Let's see what happens. Okay, after pressing the button, connect. This is the window that this place and I have to select the second option. The option that says connect your application. I select the second option on now the reset button that says copy so I press the button. Copy, Aunt. Now I close this with the president on clothes, and this is it. Now I have my connection is drink. Now I have to. What we have to do is to pace to my connection is strange like this onto the next step that I have to take is to split this connection string into several pieces for reliability ons. And now I have toe specify the password. Remember that the password for these database is hello. And, well, if I press a button collections, let's see what happens if I press the button collections. Okay, After pressing the button collections, this is the Web page that this place on, as you can see, I am, I am working with the database profiles. So I have here a lot of ways Koth profiles. So I have to a specify such that Batteries, I think in profiles like this on this received my connection is strange, has already being configured. Now what I have to do is to configure the function that will be used if, as if something fails. So if something fails, he sees the function that will you run on this function basically will display a message to the council on the message on the Miss Ash will display a never message. Sorry. Okay. If something fails with the connection through batteries, these function will be used. And this function, this place, the error message to the council. But if everything works fine on the connection to a lot of ways succeeds then Ah, it these function will be used. So if everything works fine, if the connection to that of a succeeds, this is the function that will be used on dysfunction will display a message to the Council on the message will be success. Ah, the connection to mongo DB works. Okay, so now I just configured my connection to the batteries. And now the next step is to configure Andi scheme as well as a model. So I have to add a comment for figure. A schemer turns model. Andi, remember that. Remember that skimmers are description off the documents that are stored inside the database. In order to create an Eskimo, I have to declare a new variable. The valuable will be pushed from a schemer Gusteau s kema on, uh, in order to create a scheme I have to use new mongoose dot schema on, Asai said. And a schemer is a description off the documents that will be a stored inside the batteries . So and my documents have four properties, but the properties that I want to describe are the properties, user name, email and password. Each off those properties are off the type A string. So again, and the properties that I want to describe and they are the properties user name, email and password, and each off those properties are of the type A string. So, um, I have, like, being used. Her name is off the type of strange Ah, email east over the type strength, Uh, does work ease off the type of strange as well? So this is it. I've just finished my skimmer on now what I want to do east to create a model. So I have to create a new variable Costa mother. Okay, You guys know what I have to do is to create a modern. So I kept to create a new variable called Costa Modern on, you know, not to create a model. I have to use mongoose dot model on the's middle. That requires two parameters. The first parameter specifies the collection. Well, the first parameter is specifies the collection that we're going to use on. In this case, I'm going to use the collection called Loggins. So I have to specify such collection as the first parameter. So I take being logging. But I remember that I have to use the name off the collection without s. This is very important. You have to write the name of the collection without s Onda. And then you have to a specify the variable that contains the schema that east the variable custom, a schemer. And as you can see so far, we have created the model as well as you schemer on. Now what I have to do is tow Go back to the template. And as you can see, the information is sent to the server using the post metal on the information is sent to the server. So the road it slash looking, so I have to create and a new road that handles post requesters and, um, I have to use up the post on the road will be a slash logging. Remember that the information is sent to the server toe their road a slash logging. Now I have to create a function that will fondle the user. In booked on this fool shall cast parameters. Request and response. Andi. Well, what I want to do now is to configure your body. Parsons, remember that voting purser, um enables you toe. Remember that body part, sir, is the dependency that enables Do toe candle the user input from HTM and forms. So I have to configure really part. Sir, I have a comment. Ah, the parcel. Kofi, You're body purser's. But in order to configure body parts that have been up juice a body part, sir. Thought you are l and go This, um, on the option will be extended on. This option will be set toe force. Andi. Now I have to use another statement at the juice Bully Purser's does Jason on this is it. I've just configured by the parts urgently dependency that handles the user input from html forms on, um, as you can see body parts. Er is also, um, improve it at the beginning off these files. Well, now what I have to do east to save the user input into two different variables. So I have to add a comment saving, uh, masterworks saving input Saving user input into variables on the first valuable will be lit . I have to create any variable so I can't that I mean, let a bar e mail on the new variable will be set to request the doctor body that if I go back to the template, you can see that the first text field has the property name. Has the attributes name said to user email. So I thought that I mean, the user email on I have to create another variable. So I got a bean let bar password on and these variable will be set to request that body that if I go if I go back to the to the HTML template, you can see that the second text field Ah, cast the attributes name said toe user password. So I have bean the yusor fast worth and this deceit I've just saved the user input into two different variables on now what I have to do east to verify whether the yusor I have toe to verify whether the user name that whether the email and passport are correct or valid s. So I have to add a comment. Verify email on pass Worst. Now, in order to verify the email and password I have to make, um, I have to I have to look there. I have to look information inside the that the race. So in order to verify the email and password, I have to, um, to make a request. So the so the batteries. So in order to make our request to the so the batteries, I have to use the model. Remember that the model is a store in the variable custom model. So the model is a story in the variable custom model. So I hope that I mean ah Cousteau model that. Okay. As I said, I want toe make a request to the database. I want to find some information inside the that the race in order. Verify whether they email and passwords are correct. So I have to use the modern, and then I have to use the metro find one on the's. Metals required Has two parameters. The first parameter. It specifies the document that I want to find in this case. I want to find a document who's Ah property. Email equals the value off the variable. Our email aunt whose property passport equals D body. The value off the variable bad password. Aunt, uh, then I have to define, um, the callback function. I'm well, Well, I think this is it for these for this lesson. In the next lesson, I will continue working on this application that creates a logging system. 43. Login 18: welcome guys to another lesson off these Bigelow Toria. In this lesson, I will continue working on the application that, uh, that creates a longing system on Dwell in the produce lesson. Are you started making you started configuring the's metals. They find one medals on for as mentioned before. Uh, these met both finds one has two parameters. The first parameter Ah, if is enabled the the first parameter enables Do toe find a given document. In this case, I'm looking for a document whose property email equals the value off the variable bar email on whose property passport equals the value off the variable Bart password on after such document has been found. Um, I have toe they call back for mission will be run. And this callback function has two parameters. Aero on Doc on everyone, the parameter error will be used. Ive something fails on the parameters. Doc will contain the information that was found inside the that race again. The parameter look, we contained information that was found inside the batteries. Now, what I have to do is to is to create any a statement This if a statement will be used if something fails So if something fails, Andi, Um, if something fails, um, with a mongo db then this. If a statement will be used on thes statement will display a message to the console on, uh, this if a statement well, a sent a response to the web browser and the response and the response will be, uh, something. Ah, something when Wen Brown Wheat mongo db. Okay, this is the message. The message that will display to the browser if something fails with mongo DB Now I have to create another statement, Another even statement. Ah, these Eva statement will be used if nothing is found inside the database. So if the past would leave the email on passwords are not correct, then, uh, then the email and password are not correct. Then, um, nothing will be found inside the database. Andi. Then thes Eva statement will be used. In other words, these even statement will be used if nothing is found, which means this statement will be used if the email and passport are brown. So if the email, email and passwords are incorrect, then these If a statement will be used on this eve, a statement will send a message to the console that says the bus work. And, uh, the password and email are wrong on If something goes wrong, then thes message will be sent today with the with browser. Uh, the first word on email are brown are incorrect, are incorrect. Okay, on If everything is working, fine. If they have the email and password are valued or are correct, then this if statement will be used. So I think Bean Doc is other than the one. So if everything works fine on the email address as well as the password passwords are correct, Then this if statement will be used on these. If a statement will send a message to the console that says the email and pass work and past work are correct on these key for statements. Ah, well sent a message to the so the browser that say's the email and password. Our values on this is it. I've just I've just finished this small application. Now what I have to do is to try to test this application to verify whether this application works or not. So I have to go back to the council and I have to stop. Um my application by pressing the keys control. See? So I have to present keys control, See to stop this application. And now I have to restart peace application on. Let's see what happens. Okay. Now, as you can see, everything appears to be working. Um, So, um, I have to do is to go back to the tow them that race. And as you can see, I have created a user called Raimundo Sanchez. And this juicer. Pass the password. 123456789 10. So, again, I have created a user whose user name is Raimundo Sanchez. On whose password is 123456789 Then So I'm going to use such credentials. Test my application. So, uh so? Well, if I go back again today so that a waste, you can see that the user, Raimundo Sanchez, has the email address. Hello. A robot gmail dot com On fast the password. 123456789 10. So I'm going to use such credentials to test the application on. I have to take being the email. Hello? Are nobody made that? Come on. The password will be 123456789 Been now I principle to log in. Let's see what happens. As you can see, this is the message that this place the email and passwords are valid. Uh, which is? Which is correct? The email and passwords are valid. OK, which means my application is working so far on now. If I go back to the logging on what I want to do now, East toe typing on incorrect password. So I'm going to type being an incorrect password, I'm going to use the password. 123 and now I president or lotion. Let's see what happens on. But this is the message that this place, the password on email are incorrect, which is is correct. I mean, um, as the message displayed that this place says Tipper's work and email are incorrect, which means my application is working. So, um, again, if I try with the correct password 123456789 thin? No, I pressed logging. You can see that the message, the email and passport are valid. This place, which means my application is working. So s so far my application is able, toe. Uh, So is the spirit is able to verify whether the the email and password are correct or not. Andi Well, I gave this. Is it for these? Listen, in the next lesson, I will continue working on this application. 44. Login 19: Okay, guys, welcome back to another lesson off. He's with Victoria on. Dwell in these new lesson, I will continue working on the application that that creates a loving system on. Well, now the next step. Well, now, the next step is to create sessions on to create a session variables. So in order to create sessions and session variables, I need to install a new dependency. So I have to go back to the council and what I have to do now he's toe a stop these application. So I have to present keys, Controversy President is called. I have to press the keys controversy on. Then I have to install a new the presidency. So I kept being no package money year install, double dash safe and then ah, express session. This is the dependency that I need to install in order to use sessions. So now what? I know. Wanna have to lose to hit, Enter on. Let's see what happens. Of course, this process takes a while, so I have to skip this part off the process. Well, now you can see the dependency express session has already being installed inside the project. Now what? I have to do is tow declare a new constant. So I have to take being constant session on its value will be set to require express decision on Now. What I have to do is to configure Tokyo, figure the decisions, So I have to I have to add a new comment that says a configure sessions. So in order to configure sessions, I have to use help typing at use. Then session on. Um Well, remember that I declared declared our constant session. Okay, this is very important. I declared declared a constant session. I created a constant session on. Now I have to use such constant. So I think position on, then. I have toe config your decisions. So the first option will be Ah, secret secret on this is like a way of protecting the information. So when we're working with sessions, um, a session ideas creative on in order to create to protect a decision, I ve I have to create, like, growth. So the secret option contains a coat on the's code Can be anything that you like. Um, it can be any strength off text that you like. So in this case, I'm going to use the string. Uh, hello. Hello? Right. These will be via string that I will use, but you can use any other strange off text that you like. Okay, um, now the other option will be re safe, and I'm going to set this option to false on three. Other option will be safe coun any she realized. And I'm going to save. I'm going to set these option toe true. Now, these are the tree options that you need to configure in orderto work with Sessions on. Now, what you have to do is tow. What you have to do is tow scroll down the coat. Andi. Now, remember that these Eva statement right here, uh, is the Eva statement that will be used if the email address as well as deep as work are valid. So if the email address, as well as deep as work are valid or are correct, then thes thes if a statement will be used so and now what I want to do East to create, um, is to create session variables. So I have to add a comment. Create session variables. Onda. Remember that Session variables are variables that are available throughout the application . That is what will session variables are variables that are a high level througout the application. OK, so in order to create a session variable, you have to take being request the session dot and now you have tow create the name of the variable. In this case, the name of the variable will be, uh uh identify year eventing. Five year, even the fire. Okay, so you can see I've just created my first session variable on the value of these variable will be set toe. Well, remember that the perimeter, doc, the perimeter dog contains the information that WAAS found inside the database. These were important. The perimeter doc contains the information or the document that was found inside the batteries. So if I go back to the to the database, you can see that each each document contains a property Underscore ivy. So, for instance, these documents right here has a property underscore Ivy. So what? I went to you. What I want to do is to save the ivy, so I type being doc dot underscore idee. Now, what I want to do is to create another session variable andi station valuable will be user name on its value will be set to dock dots. Uh, remember that each document has a user name property, so I have to be in the user name on now if I want to create another station, Variables, what they mean requested that session dot on email will be the name off the next off the off. These session variable on its value will be set to dock that if I come back today, that are ways you can see that each off the documents has a property email. So I had a bean dog. Don't email. Andi, I finally have to create another session. Variable, variable. So they've been request that session dot um, fast work. And, um, these variable will be said toe doc thought if I go back to the other ways, you can see that each off the documents has a property password. So I have to take being dog both fast work on this is it? I've just created, um I just creative 44 session variables. And after that, what I want to do is to reconnect the user, toe another with page, so I have to add a comment Really directing you surf on in order to redirect the user toe a new webpage have type in response dot Uh, ready wrecked on the user will be re directive toe toe the webpage it slash That's worth so . As you can see, if they give the team an email address and password are valid, then four session variables will be creative aunt then. And finally the user will be read Directive toe a new with peixe on. Such with page has the address slash that's worth on. Of course, I have to create a such road. So I thought that bean up the get on it slash that's worth on. This is it. Now I have to create the fusion on these function. We have two parameters requests, response. And, um well, thes. Okay. Well, thes road will be these webpage, or these roads will behave in a different way, depending on whether the user is looking or look out. So if the user is look out, then it means that the session variables don't exist again. This is very important. If the user is logged out, then it means the session variables don't exist. So in that case, these ive a statement will be used. So, uh, if decision variable identify here does not exist, it means the user is Look out. And if the user is look out, then, uh, this message will display to the council. The U sir, he's Look, look out on, uh, if the user is look out, then these message will be sent to the to the web browser on the missus will be the you. Must you most looking you must low gheen to see these the's webpage with patience. So if the user is look out, uh, then, um, these Miss Ash will displace will display to the rousers You must log in to see these webpage. So I also want to ask Ah, a paragraph tack. Sorry on ensure tough for these bunch of tough we'll redirect the user toe to the logging a farm. So Okay, if the user is look out, Look out then This message will be displayed to the browser you must log in to see it is with page on. The looking text will contain a link today to the logging with fish. Okay, Aunt. Um well, in the case that the user is love locked in. So in the case that the password on Gmail address provided by the user are correct, then ah, then what is going to happen? He's, uh, is thes. So if the user, uh, uses the correct email address as well as the correct password, then things message will be sent to the council. Ah, you're you're credentials are correct on the's message will be sent back. So the to the Web browser on the message will be, Ah, you are looked in. You are low in well, eso as you can see these thieves their behavior off these road. If the user is he's look out. I miss ash this place to the browser that, uh, that a Mrs displaced to the browser on the moustache Uh, he's asking the user to begin on if the user has provided the correct email address and passport, then a confirmation message this place Well, I think this is it for this lesson. In the next lesson, I will continue working on this application 45. Login 20: Well, guys, welcome back to another lesson of these beauty tutorial in this lesson or until a in this lesson of these with Victoria, I'm going to continue working on the application that creates a longing system on. Well, in the previous lesson, we have created our road that that contains the bat slash Dutch fourth. And, um, we we configured our were our application so that the user is Look out then, um, the application behaves in a certain way. But if if the user is locked in, then the the application behaves in a different way. So a what I want to do now is toe best. These application, Aunt, um well, I have to open the comment. The console aunt. Now, what I have to do is to run these application, so I have to take being well, as you can see, right now, I am in the council and I have that I have to run these applications, so I have to type in note server doctor. Yes, I hit. Enter on. Let's see what happens. What? Well, as you can see, it appears like everything is working Fine. So I know what I have to do is go today with browser on and well, if I go to the Mongol, deviate less. If I go to the Mongo Devi website, you can see that I have you, sir. I have three users in the batteries. Andi three First user has an email address equals toe. Hello. A robot gmail dot com On the password for that user East 123456789 10. So I'm going to use those credentials toe test my application. So now I am here in the application on I'm going to type in the password. 123456789 10. And now I want to press a button looking, Let's see what happens. As you can see, the message that is displayed is you are locked in, which is correct on, which means my application is working. Now. If I go back today to the HTML form on, if I used on incorrect password, let's see what happens if I eat I. If I input input an incorrect password, let's see what happens. I'm going to use the password one through three. Remember that this password is incorrect. So let's see what happens if I press logging on a massage. Is this play is displayed on the moustache says the password on Gmail are incorrect. Which means my application is working. So far, so s so far. My application is working Well, no. Uh, now what I want to do now what I want to do, ese is trying toe. Okay, now what I want to Dewey's continue working on this application on Well, in the case that the the password in the case that the email address on password are correct then. Okay, guys. Well, in the case that the password on Gmail address are correct, then what I want to do is to send a template is to send a template today Web browser. So the template will be that sport dot a Yes, on what I want to do is to pass some information to these template on the information that I'm going to pass to this template. He's a variable profile or an object profile. And this object profile ah, will contain four properties. The first, the first property will be ivy on its value will be said, uh, the value of the property. Ivy will be will be equal to the session variable called Request That session, the identifier, even the fire. Remember that we created these session variable above in the Goethe. As you can see, this is the place where the session variable was created on on. Now I have to create another property. The other property will be user named on. Its value will be equal to request session request that session dot Ah, use Ernie on now I want to want to do is to add one more property. The property email on its value will be said will be equal to request the session dot Ah, email as well. And finally, I want to add one more property. Andi, while thes property will be equal to request that session dot um, password. Now, as you can see, I am you seen the decision variables that I created earlier on? What I'm doing here is that I am passing the session variables toe the template cold. That's war does a year. Yes. Okay. You know what I have to do is to create the template and that's work. That a yes. On a side you can see I am creating a new file on the name of this file will be a dash board bash Ward. Look a year. Yes. So this will be my html template. Aunt will. The title for this template will be dashboard Andi. Thesis template will have Heather one on the text. Off this together will be that sport as well. Andi. Now this template is going toe. Verify whether the variable profile exist. Okay? These system plate must verify whether the D valuable profile exist. Remember that I am sending the the profile variable toe the template. So, as you can see, we have here the profile variable on this provide valuable comparative contains an object. So, uh, what I have to do is to verify whether such variable profile exist Profile. Okay, ive the variable profile exist, then. Ah, Then these if a statement will be used. So as you can see here, I have the if statement that is testing whether the variable profile exist or not so well, in the case that the variable profile exist. Then what I want to do is simply, uh, to display a lift on these diff tough will contain 4.4 paragraphs as you can see am creating the paragraphs. Okay, The first paragraph will display the user I d on. Remember that the use of ivy, he's a store in the property. Uh, profile dot ivy. So I have to take bean profile the idea. Now the second paragraph will display the user name on. Remember that the user name. He's a stort in the property profile. Don't use her name, so I have to type in profile the user name on now. The third paragraph will be used to display the email the user. So, uh, in order to display the email off the user, I have to use the property profile both email. So they being profiled the email on Finally the fourth paragraph will be used to display the passwords. So I think being fast worked, Aunt, remember that the password is stored in the property. Profile the passwords. So I have to take being profiled. The pass work on this is seats. Now, my template in this place the user in the profile off the user on if they variable profile does not exist, then the else statement will be used. And ah, well, the else a statement we'll display um, a feather. Want that on this together? What that will contain on, uh, Miss Ash, that says, um, the yusor profile waas not no formation found. Okay, no information found. Okay. These moustache will display if the, um if the variable profile does not exist Well and now what I want to do East toe af one more Wooten to my application. Remember that the user must be able to look out eso I have to ask on. And your attack toe the center attack or his link well are ready like the user toe the road slash Look out. Uh, remember that the user must be eight. Must be able to look out. So I have to create a link on if when the user clicks this link, the user will be log out. So, um Okay, So this is it. I guess this is it for this lesson in the next Listen, I will show you how you can I configure the lookout link so that the user has the ability to destroy the session information. In other words, the user must be able to look out when necessary. OK, but the next Listen, I will be working on these application the candles sessions 46. Login 21: Okay, guys working back toe. Another lesson of these will be the Victoria. Now in these Listen, I will continue working on this application that creates a longing system on. Well, what I want to do now is to configure the log out little or the log out link. So as you can see, these log out link, uh, points points the user toe, the address is lash. Look out. So I have to create a new road that handles the bat it slash Look out. So I have to go back to the server and I'm going to create a new on you wrote so that I had to tidying up get is slash. Look out. And now I have to create a function on. Now, what I want to do is to destroy the decision variables. So I have to use a function that is called request that session thought destroy Andi Thes metals will contain function on these function. We have a single parameter. Well, as I said, Thies, in order to destroy the decision, variables or in other words, in order in order to look out, we have to use the metal, destroy the metal request that session don't destroy. And these middle has a function as a parameter. Andi, Um, what I want to do now, after this session is destroyed or in other words, after the use Aries, Look out what I want to do. East toe red Effect the user toe to the logging webpage. So I have to bean response. Don't redirect on. I'm going to redirect the users today to the roads. Ah, slashed logging. In other words, after the user east, look out! Ah, the user will be taken toe the looking HTM inform So well, I guess this is seemed like this is this is it. Now what I want to do is to test this application. So I have to go back to the gun. So and I have to stop this application by pressing the keys controversy on. I have to restart this application on Let's see what happens. Eyes. Now, As you can see, it appears like the application is working. So now what I have to do is go back to the Web browser and I went toe test this application . So in order to test in order to test this application, I want to use they I have were inside my inside the that always I have a user whose user name is Michael. On whose email is Michael Araba gmail dot com. On whose password he's 12345 So what I want to do now is to test my application by using the email address on pass work. Offer you off the user, Michael. So I go back to the jail today. I have to reload thes looking template on going toe. Typing the email. The email address Michael a robot email dot com on the password will be 12345 and now I principal toe looking on. Let's see what happens. As you can see the user, I d this place as well as the user name Michael. The email address My Colorado. He may not come as well as a password. Now what I want to do is to look out or too close decision. So in orderto in order to look out what I want to do now east to press the link at the bottom of the page that says, Look out well, eso What I want to do now is to look out. So in order to in order to look out, I have to press the link that is placed at the bottom off the base that says, Look out, Aunt, as you can see eat appears like I have a mistake. I've made a mistake. So now I have to go back to the to the Goethe. Andi, correct the mistake that I made. Yes, yes. I made a mistake in the growth I felt to specify. Specify the perimeter request on response on This is it. I just fixed the this error and now I have to go back to the council. I have toe stop this application by pressing the keys controversy. And now I have to restart the application. OK, guys. Now, as you can see, it appears like everything is working. So I get have toe test this application one more time, so I have to go toe there. I have to go toe the logging. Ah, so the log in template on. I'm going to use the email. Michael, on the passport. 12345 Now a president or looking. And as you can see, the user information this place Now what? I want to do is to look out. So I have to press the link that says, Look out at the borough haptik at the bottom of the page. Andi, this receipt this the station has been closed. Now what I want to do East toe use other other credentials from from him from another user off another user. So, as you can see in the database, I have the user whose name is Andy. On whose email address is Andy. Everybody main dot com hand whose password is 1234561234 Fight. Sorry. So I'm going to try my application with these other credentials. Andi, everybody may not come. So I go back to the template on I think being gundy a robot gmail dot com And now I use the password. 12345 Now it president or looking. And as you can see, the user information this place user name Andy email and the a remedy made that come Passport 12345 Now what I want to do is to look out. So I present link, I click the link. Look out on this. Is it Well, as you can see now, my application works on, but well, there is one more thing that I have toe improve in this application. So, uh, in the next lesson, I will continue working on these applications. So that, uh, in the next lesson, I will continue working on these applications. So that decision variables are a start in the mongo DB in the Mongo Devi that awaits. So in the next lesson, I will show you how you can store the session variables inside the mongo db that arrays. 47. Login 22: Well, guys, welcome back to another lesson off these dictatorial in this lesson, I will continue working on the application that creates our logging system. Um, so what I want to do now east toe to create east to what I want to now east to a store, the session variables inside the batteries. So, um, as you can see, I have four session variables here and what I want to do East to a store. The values off these variables inside mongo db. So, in order to store decision variables inside mongo db, but I have to do is to install a new dependency. So I have to stop this application by pressing the keys controversy. And now I have to install another dependency. So I thought that I'd be north puckish man. A year in style, in style, double dash, safe on the dependency that I want toe in style. Now he's a connect Mongol. These dependency enables you toe a store session valuables inside mongo db. So now hit. Enter on. Let's see what happens. Well, guys, Now, as you can see, three dependency connect mongo has already being installed inside the application. So if I go back to the because, Jason File. You can see that the dependency connect mongo appears listed in the Packers. Jason file. So now what I have to do is to go back to the server Dodger. Yes, File. And I have to declare another constant. So I think being const among go store on its value will be said toe required required connect Kamenetz, Mongol, and then a session. And this is it. This is all that we need. Toe includes thes dependency in the project. And now what? I have to do East toe Toko figure decisions. So I have toe scroll down on um remember that decisions were coffee. You're here. As you can see, this is the is the growth that is juiced Toko figure decisions. So, um okay, this is the growth that we used to configure the sessions. So I'm going to us. So what I want to do now east to add a new property. So these coat that configures decisions andi property will be a store on its value will be set to new, uh, Mongol a store. And now what I have to do is to provide on object on these will this thesis. Manco store metals requires a parameter, and this parameter is an object. Andi, this object contains well in order to configure. Um, the the session is store. And what I have to do is to add a new property on the property is morning Goose. Magoo's connection on its value will be said to mongoose dot connection on. Well, I guess this is it. Um, yes, I guess this is it. This is all that we need. So, um well, these gold, we'll make the session variables to be safe, to be saved inside the mongo db. That always so what I want to now east toe test this application to verify whether decision a store is working. So I have to go back today to the council on I have to run the application. So, uh, well, a so you can see the reason Mistake. There is an error with the growth, so I have to verify that. Okay, well, that you can see as we can see and the recent me on error in the goat. So I have to remove these things character here and now I have to go back to the council on and I have to run this application again on let's see whether everything is working. And yes, it appears like everything is working. So now what I have to do is go back to the Web browser on And, um okay, if I Well, I'm going toe press the Bhutan askew can see I am inside the the that the that raised the mongo db. I don't mean the mongo db side on. Now. What I want to do is to press the button, refresh at the right side off the screen. The result on that self refresh. So I present to refresh on Let's see what happens. Well, as you can see, a new collection has bean a teeth toe the batteries on. As you can see, I have one more. One more collection. The Logan's collection. He's the collection that we were using in previous lessons. But here I have a new collection that is called Sessions. So these new collection, the collection sessions, Well, a store, the session variables. Okay, so, in orderto taste my application Well, as you can see in the collection sessions, we will store the session variables. Now I have to taste my application. So, uh, I'm going to use some credentials on and okay, In order to test this application, I'm going to use the email address on the robot gmail dot com, whose password is 12345 So, um, I have to it toe input the email address on the everybody made that. Come on, the password will be 12345 No, I breast logging. And as you can see now, uh, the information of the user, this place. But if I, um okay, if I go back to the database on If I opened the sessions the collection sessions, you can see that inside the collection sessions. The reason a new document on these, uh, these documents contains some information. Okay, guys. Well, now, if if you analyze these new document that appears on the screen, you can see that thes document contains the user information. In other words, these document contains the session variables. For instance, if you pay attention to the to the screen, you can see that in the screen. This place user name, Andy, email and the robot, gmail dot com and password. 12345 In other words, decisions variable the say these session variables have bean distort inside these new document. So in other words, decision variables are being saved inside the mongo db That always so on. Now you know how to save this issue in variables inside mongo db On again. If you pay attention to the to the text that appears on the screen, you can see that on the user name. Variable appears on its value ease. Andi, the email address appears as well on its value East on the robot gmail dot com on the password appears as well, Andi, The past work has the value. 12345 So, um, again, the session variables have been saved inside among go db. So, um well, I gave this a seat. Guys. Now you know how to save section variables inside mongo db on, um Well, guys, this is it. Burns. See you in another tutorial by