Skip to content

Latest commit

 

History

History
86 lines (64 loc) · 3.2 KB

README.md

File metadata and controls

86 lines (64 loc) · 3.2 KB

React Google Book Search

A React-based Google Books Search that displays books on user searches. This application search for books using the Google Books API by typing in a title and clicking on "Search". The user can view the book which will bring them to the page on Google Books by clicking "View" in the results for the search. Future update will be working on the "Save Book" button to save the book to the database.

Packages Setup

  1. npm init => initialize package.json
  2. npm install => create package-lock.json
  3. npm i monggose => install mongoose package
  4. npm i axios => install axios package
  5. npm i react-router-dom => install react-router-dom package
  6. react-toastify

Database

  1. Connect to a MongoDB database named googlebooks using the mongoose npm package.
  2. Using mongoose, create a Book schema.
  3. Books should have each of the following fields:
  • Title - Title of the book from the Google Books API
  • Authors - The books's author(s) as returned from the Google Books API
  • Description - The book's description as returned from the Google Books API
  • Image - The Book's thumbnail image as returned from the Google Books API
  • Link - The Book's information link as returned from the Google Books API
  1. Example JSON:

Screenshots

terminal MERN searchbook

Github MERN searchexample

Technologies Implemented

  • MVC design pattern: Model, View, Controller.

Github MERN logo

  • MongoDB
  • Express
  • React
  • Node.JS
  • Search for books using Google Books API
   getBook: function (query) {
    return axios.get(`https://www.googleapis.com/books/v1/volumes?q=${query}`);
  },
  // Delete book with the given id
  deleteBook: function (id) {
    return axios.delete("/api/books/" + id).then(result => result.data);
  },
  // Save book to the database
  saveBook: function (bookData) {
    return axios.post("/api/books", bookData).then(result => result.data);
  },
  // Get saved books from the database
  savedBooks: function () {
    return axios.get("/api/books").then(result => result.data);
  }

Prerequisites

  • Created a Mongo Database called "google Book".

Built With

  • Visual Studio Code - Text Editor
  • MongoDB
  • Terminal/Gitbash

Author