An open API service indexing awesome lists of open source software.

https://github.com/gh-aam/book-listing-server

A simple book listing server built with Express.js.
https://github.com/gh-aam/book-listing-server

express express-js express-middleware expressjs javascript javascript-applications javascript-es6 javascript-framework

Last synced: about 2 months ago
JSON representation

A simple book listing server built with Express.js.

Awesome Lists containing this project

README

          

# book-listing-server
A simple Express.js server that provides a list of nature-themed books with support for search and detailed views.

## Features
* Request logging middleware
* Home route
* Book list route which returns a list of all books
* Book search route which searches for books by title
* Book details route which fetches book details by ID
* Error handling middleware for unknown routes

## Installation
```bash
git clone https://github.com/gh-aam/book-listing-server.git
```
```bash
cd book-listing-server
```
```bash
npm install
```

## Usage
Start the server:
```bash
npm start
```

Or during development with hot-reload:
```bash
npm run dev
```

Once the server is running, visit:
* [http://localhost:3000](http://localhost:3000) - Home page
* [http://localhost:3000/books](http://localhost:3000/books) - Book list
* [http://localhost:3000/books/search?title=wild](http://localhost:3000/books/search?title=wild) - Book search by title
* [http://localhost:3000/books/3](http://localhost:3000/books/3) - Book details by ID

## Example Response
`GET /books/3`
```json
{
"id": 3,
"title": "The Overstory",
"author": "Richard Powers"
}
```

## Scripts
* `npm start` - Start the server
* `npm run dev` - Start the server with `nodemon`