exprees
Wed Aug 03 2022 21:25:52 GMT+0000 (Coordinated Universal Time)
Saved by @Naredra
introduction Making avery part of contact list >without the data base part SECOND PART Creating a contact list need to make a array var contactList =[ {name : "narendra " mobile :"929"}, {..}, {..} ] how can i pass this to funtion example app.get('/',function(req , res)) so what learn is that http request = product/items/1 various methods 1. get -> product/items/1 means i want to show all the details availble at this point or from the resource 2. put-> product/items/1 means i want to upadate this url 3. post-> means i want to add resources at this point 4.patch -> mean i want to upadate a small segment finaly app.get('/',function(req , res){ return res.render('home' ,{ title: "contact List", contact_list:contactList }) }); so what we learn is that to make a dynamic contact list where we don't need to write things again and again just need to use for loop by using ejs how to write for loop in ejs <%for(let i of contact_list ) %> <% %> 3. SENDING DATA TO THE SERVER Now what we have : 1. we have a list which we can show in the screen what we want to do 1. to add somethig 2. to delete something 3.to make it more dynamic so what we are going to do in this video 1.creating form to take data from the user 2.reading that from and adding this to present contact list creating a form <form action ="" method ="POST"> <input type ="text" name ="name" placeholder ="Enter your name"> <input type="Number" name ="Phone" placeholder ="Enter your phone no"> <button type="submit">Add contact</button> </form> makingg is dynamic Parser Middle ware app.use
Comments