ICP6 - pondurivenkatesh9/WEB GitHub Wiki
Name : Venkatesh Ponduri
Id : 23
Team : 4
https://github.com/pondurivenkatesh9/WEB/tree/master/ICP6
Code:ICP 6 TASK:
To create an web application in which we can add book details using Mongo Labs which is a cloud to store the data given. The application should allow user to update and delete the data given. In this application we are entering book details like ISBN number, author, copies of books and edition of book etc. The below figure shows the home page of we application which is displayed by running the html code.
Adding Book details
By giving valid details of book the user clicks on the add button which adds the book details to web page and cloud. This is done by using post method. The code snippet is below.
outputs of post method
The following image shows the addition of book details to web page.
The following image shows the addition of book details to cloud.
Second book details are added to web page
Second book details are added to cloud.
Updating Book details
Now coming to updating the book details we use Update method. Here we filter the id of a book with existing book ids and then we pass the book details and then we update the book details. The code description is below.
Outputs for update method
Here i am changing the second book copies number and clicking on save edit button which saves the edited data. By refreshing we can see that the data is updated in the web application.
The same update is printed in the mongo lab as shown below.
Deleting the book details
Now we have to perform the delete operation Which means when we click on the delete button the book details should be removed from web page and cloud. To perform this operation we used deleteone method. Here i am directly passing the id of the book and by using the deleteone method i am deleting the book details form both web page and cloud. The cod esnippets are below.
Outputs for delete method
The below figure shows the deletion of first book details from the list. By clicking on the delete button the first book details are deleted from the list.
The same repeated in the mongo labs where the first book details are deleted.