This repository has been archived on 2024-12-15. You can view files and clone it, but cannot push or open issues or pull requests.
seepur/app/Controllers/Http/BookApiController.js

27 lines
680 B
JavaScript
Raw Permalink Normal View History

'use strict'
const FileUtils = use('App/Utils/FileUtils');
class BookApiController {
async getPage({request, book, response}) {
const pageNumber = Number(request.params.pageNumber);
const file =
await FileUtils.getFile(`books/${book.book_folder}/${pageNumber}.jpg`);
if (file)
response.send(file);
else
return {
code: 404, message: 'no file'
}
}
async getThumbnail({request, book, response}) {
const file = await FileUtils.getFile(`books/${book.book_folder}/1.jpg`);
if (file)
response.send(file);
else
return {
code: 404, message: 'no file'
}
}
}
module.exports = BookApiController