GET /books

Returns the list of books from the library, will be helpful if you are trying to display all of the books at once

Endpoint URL

http://127.0.0.1:8080/api/books

Example code

const loadBooks = async () => {
    try {
        const response = await fetch("/api/books");
        const books = await response.json();

        // Sort the books by _id
        books.sort((a, b) => a._id - b._id);

        return books;
    } catch (error) {
        console.error("Error fetching books data:", error);
        throw error;
    }
};

Example response

This only shows the first book but all books in the library will be returned, this is not recommended to be called regularly as it can be quite taxing on a machine and slow down your users browser

Response fields

Name
Type
Description

_id

integer

This is the identification number, which is unique to each specific book

newrelease

Boolean

A Boolean value to determine whether or not the book is a new release and would therefore show up in the new release section if this is true

title

string

The title of the book

isbn

string

The International Standard Book Number for this specific book

pageCount

integer

The number of pages in the book, all pages are included

publishedDate

date

The date at which this copy of the book was first published

thumbnailUrl

string

Image URL for the thumbnail or cover of the book

shortDescription

string

A short description of the book, acting as a blurb

longDescription

string

A more extensive description which covers the major points of the book

status

string

Whether or not the book is currently published, so far all the books in the library are

authors

array of strings

An array of all authors who contributed to the book

categories

array of strings

The listed genres / categories of the book as all books are non-fiction at the moment

favourited

Boolean

Whether or not the book is a favourite for the user, as no identification system is being used, this is a global property

Last updated