Introduction | Flutter To-do App with NodeJS + MongoDB at backend | Creating NodeJS Project Part 1

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys so in this tutorial we are going to learn how to build a full stack application in flutter where I am going to make use of node.js as a backend with mongodb database so basically we are going to build a 2do application in flutter where the user will be able to register himself into the application and get logged in into the application using his credentials and will be able to create his own to-do nodes okay so let's get started okay so this tutorial will be covered in part wise so in this part I am going to cover how to create a node.js application and how to install different modules for our node.js backend okay so let's get started okay so here I have opened my visual studio IDE so first of all we need to create a folder for our node.js project so you can just go to this open folder and in desktop I have created a empty folder named node.js project so just open it in your IDE something like this okay so to make this folder as your node.js application you need to run some command so just go to this terminal new terminal okay and here you just need to enter npm in it okay so to run uh npm first of all we need to install node.js in our computer so you can just visit Google and install node.js in your PC so here after entering you can see it is asking you your node.js project name so you can just keep it empty or you can just give a name so I will just give as to do and version is 1.1.1 so just enter enter everything so there is no much required for the demo purpose okay so you can see after doing init your projects has created a new Json file that is packet.json file where you are all the requirement of your node.js application is listed over here for example name of your project version description and owner and everything okay so our node.js project is ready okay so we need to install different modules that is dependency or you can call it as library for our node.js project so we need to install them such as Express node mailer mongos mongodb and body parser and various models that are required in our project so let's install them and learn how to install it so here in the terminal just enter npm install and specify the model or a dependency that you want to install for example I want to install Express that has been used to create a node.js project for creating apis routes and everything so I'm going to make use of Express for that and the second thing is mongoose and then I am going to make use of body parser so let's use them okay so you can just enter uh as many as uh models you want to install over here so let's wait okay so once the models has been successfully installed in our system or in our project you can see a node model uh project here a folder has been created automatically and you can see in our package.json file that is the dependency key has been created that is object has been created inside which this packages are been included okay and we can install different models such as B Crypt Json web token and everything JWT okay so let's install that also okay so I just forgot one more uh package to be installed that is Norman okay so let's install it so it is basically used in automatically restarting our server or our backend Whenever there is changes in our code okay so let's install it node npm install node mon okay so it has been installed in our node.js project okay so now let's create files for our node.js project so here first of all just click over here in this project structure and just click on this icon that is new file and here first of all create index.js that will be our starting point of our node.js application and then create one more file that is app.js where we are going to make use of express.js to create routes and everything okay so here first of all let's install express.js so you if you want to import any package you just need to make use of required keyword and express that package something like this okay and then uh Here const app is equal to express so I'm just making use of this const variable to import our Express model so I'm just creating an instance of it okay and now let's make use of model dot export and we are going to export our app that is our Express so that we can make use of this app.js anywhere inside our project by importing this app.js file okay okay so now let's import this file in index.js and create our Express server okay so here const app is equal to require dot slash app okay so by doing this everything that is in this folder will get imported in this index.js now you can just create your server so to create your server uh first of all we need to define a port so let's create a const variable over here so our Port will be running on 3000 you can keep it anything as per your needs so I will just keep it uh as usual that is three thousand and now here x app Dot listen and here specify the port and declare it as a function something like this so here let's give a log saying that our server is running on this port okay so let's save this and run our project so let's check the output so to run our project all you need to do is you just need to use node and your file that you want to execute so in our case it is node.js okay so I think something went wrong so it is giving an error so let's check it out okay so here Express will be a function so you just need to declare it as a function okay so now let's run so you can see our server is running on this port okay so now let's create a simple route where whenever we hit our uh this port will get executed and we will get a response on our browser okay so for that here app dot so we are going to create a get request so get and our route will be a root folder so root here we need to declare two requests that is request and response of for our browser and declare it as a function something like this okay and here our response dot send and just pass a message so I will just pass hello world okay and let's save this file and then run our project and node install index.js sorry okay so our app has been running on this port so let's check it out so when I hit this 3000 Port you can see I am getting hello world as a response so let's change the message and check okay do I need to stop this project and restarted to check the changes so you can see okay so as you saw I need to stop this app for any changes to be reflected so for that I have installed a package called as node mailer so let's use that so to use that all you need to do is just go to this script tag over here and here just remove this or you can just give a comma over here and here Define a new parameter that is due tag and inside view tag you just need to make specify which file you want to run whenever you make any changes okay so node monk I want to run index.js so I'm just defining Whenever there is any changes in our file and I just save the file node mode will rerun this index.js file okay so let's do that and let's check if it is work if it is working or not so to run our node mon all you need to do is you just need to make use of npm run Dev so we have declared this key we want to run and whenever we run by making use of front key so we are just defining to run our node mon index.js okay so to run this you just need to run this command okay so you can see node mod is running okay so now if I do any changes over here so let's give something like this message and save it you can see nodemon is getting restarted and reflecting our data on our server side okay so let me add two more dots hit save and you can see it has been running on this port with a latest update okay so that's all for this video tutorial let's meet in our second part
Info
Channel: Proto Coders Point
Views: 31,225
Rating: undefined out of 5
Keywords: flutter tutorial, flutter app development, flutter tutorial for beginners, flutter node js, flutter node js backend, how to create node js project, flutter todo app, flutter with nodejs backend, to-do in flutter, how to create nodejs project, nodejs project, How to create Node js project using npm, Create Node JS project with Express, How to create Node JS project in Visual Studio Code
Id: rCt_Yad_4MY
Channel Id: undefined
Length: 10min 52sec (652 seconds)
Published: Mon Jan 30 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.