Didem Didem - 3 years ago 122
Node.js Question

NodeJS showing google books content on my own app

I'm developing a google books manager app for myself. I want to reach the whole book content in my own application but the google books search api gives me preview and info links in json format. Is it possible that I read the book in my own app and if it is, how do I do that with those links? Thanks

Answer Source

You need to consume the API in your application. It gives you a JSON file, so you need to parse that JSON file into a variable and then you have a standard javascript object which you can access.

Take this link for example:


Gives us a JSON file. If I wanted to get access to the first object's contents, I would do something like this:

var request = require('request');

request('https://www.googleapis.com/books/v1/volumes?q=horror', function(error, response, body) {
    var library = JSON.parse(body).results;
    var firstBook = library[0].volumeInfo
    var title = firstBook.title;
    var authors = firstBook.authors;
    // etc... 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download