DEV Community

Anjali Gurjar
Anjali Gurjar

Posted on

CRUD

// Endpoints:
// // GET /books: Retrieve a list of all books.
// // POST /books: Add a new book to the catalog.
// // GET /books/:isbn: Retrieve a specific book by its ISBN (International Standard Book Number).
// // PUT /books/:isbn: Update details of an existing book.
// // DELETE /books/:isbn: Remove a book from the catalog.
// const book =[{ "isbn": "978-0321765723", "title": "Clean Code", "author": "Robert C. Martin", "publicationYear": 2008 }
// ]

// function add(data){
// const {isbn}=data
// if(book.some(item=>book.isbn===isbn)){
// console.log('alredy is there ')
// return
// }

// const newbook=data
// book.push(newbook)
// console.log('book added',newbook)

// }
// const item = {"isbn":"121","title":"splie"}
// add(item)

// function getBook(){
// console.log('Books list',book)
// }
// getBook()
// //

// function deleteBook(isbn){
// const data=book.findIndex(item=>item.isbn===isbn)
// if(!data){
// console.log('id is not found')
// return
// }
// const deleteBook=book.splice(data,1)
// console.log('delete book',deleteBook)
// }

// deletebook(121)

// const data = {"isbn":"123","title":"spliece"}
// add(item)
// getBook()
// deletebook()

Top comments (0)