Search books using work, edition and ISBN with OpenLibrary API using a backend (Deno and GraphQL).
First of all, download and install Deno. Version 1.10
or higher is required.
Verify that the installation was successful by running the following command that should return the version number for Deno, v8 and TypeScript.
deno --version
To quickly start using the code run the following command. With the flag --allow-net
that is allowing network access.
deno run --allow-net https://raw.githubusercontent.com/DiFronzo/OpenLibrary-GraphQL/main/mod.ts
GraphQL should now be running on http://localhost:8080/graphql.
That's all you need to know to start! 🎉
The function findBookISBN
is used to find books by ISBN. The id
need to be a float. With GraphQL you can choose what result should be returned. Use the DOCS
tab on the right side for available parameters.
query
{
findBookISBN (id: 9780140328721) {
title
authors {
key
}
}
}
The function findBook
is used to find books by using the edition slug. The id
need to be a string. With GraphQL you can choose what result should be returned. Use the DOCS
tab on the right side for available parameters.
query
{
findBook (id: "OL24981637M") {
title
by_statement
publish_date
}
}
The function findWork
is used to find work using the works slug. A work is a logical collection of similar editions. The id
need to be a string. With GraphQL you can choose what result should be returned. Use the DOCS
tab on the right side for available parameters.
query
{
findWork (id: "OL81613W") {
description
type {
key
}
}
}
The function findAuthor
is used to find an author by using the authors slug. The id
need to be a string. With GraphQL you can choose what result should be returned. Use the DOCS
tab on the right side for available parameters.
query
{
findAuthor (id: "OL576769A"){
name
personal_name
alternate_names
remote_ids {
wikidata
}
}
}
Demo at this url but you need to also change the url in the editor to the same.
If you don't want to install OpenLibrary-GraphQL to your system, you feel free to using the following Docker image to run GraphQL from isolated container.
docker run -d --init -p 8080:8080 difronzo/openlibrary-graphql:latest
If you want to say thank you or/and support active development of OpenLibrary-GraphQL
:
- Add a GitHub Star to the project.
OpenLibrary-GraphQL
is free and open-source software licensed under the MIT. This is not an offical release from Open Library. Use on your own risk.