Skip to content

ByteStackx/Library-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Library API Endpoints

Author Endpoints

Create New Author

POST /authors Body:

{
	"name": "Author Name"
}

Response: 201 Created, returns created author object Errors: 400 if name is missing or invalid

List All Authors

GET /authors Returns array of all authors

Get Author By ID

GET /authors/:id Returns author object Errors: 404 if author not found

Update Author

PUT /authors/:id Body:

{
	"name": "Updated Name"
}

Response: 200 OK, returns updated author object Errors: 400 if name is missing or invalid, 404 if author not found

Delete Author

DELETE /authors/:id Response: 204 No Content Errors: 404 if author not found

List Books By an Author

GET /authors/:id/books Returns array of books for the author

Book Endpoints

Create New Book

POST /books Body:

{
	"isbn": "1234567890",
	"title": "Book Title",
	"authorId": 1
}

Response: 201 Created, returns created book object Errors: 400 if any field is missing or invalid, 404 if authorId does not exist

List All Books

GET /books Returns array of all books

Get Book By ID

GET /books/:id Returns book object Errors: 404 if book not found

Update Book

PUT /books/:id Body:

{
	"isbn": "0987654321",
	"title": "Updated Title",
	"authorId": 2
}

Response: 200 OK, returns updated book object Errors: 400 if any field is missing or invalid, 404 if book not found

Delete Book

DELETE /books/:id Response: 204 No Content Errors: 404 if book not found

About

CodeTribe NodeTs Library API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published