DEV Community

Discussion on: Simple REST API with Deno

Collapse
 
paulotumba profile image
PauloTumba

const getBook = ({ params, response }: { params: { isbn: string }; response: any }) => {
const book: IBook | undefined = searchBookByIsbn(params.isbn)
let indece:any;

indece=params.isbn
let index=indece-1

if (book) {

response.status = 200
response.body = books[index]

} else {
response.status = 404
response.body = { message: Book not found. }
}

}

i made some changes, on get by id it was returning only the first register