https://github.com/gabydevdev/guiando_api
https://github.com/gabydevdev/guiando_api
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/gabydevdev/guiando_api
- Owner: gabydevdev
- License: gpl-3.0
- Created: 2024-08-09T00:52:03.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-19T19:23:21.000Z (over 1 year ago)
- Last Synced: 2025-01-18T07:22:08.908Z (about 1 year ago)
- Language: JavaScript
- Size: 123 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Guiando API
Guiando API is a simple Express-based API that serves booking data from JSON files stored in a directory. It is designed to be lightweight and easy to deploy, with basic functionality to retrieve booking information.
## TLDR;
1. **Installation Instructions:** Clone the repository and install the dependencies.
2. **Configuration:** Adjust the `.env` file according to your environment.
3. **Run the Project:** Start the server using `npm start`.
4. **Explore the API:** Use the provided endpoints to interact with the booking data.
## Features
- **Retrieve Booking List:** Fetch a paginated list of bookings.
- **Retrieve Single Booking:** Fetch details of a single booking by its ID.
## Requirements
- Node.js
- npm (Node Package Manager)
## Installation
1. Clone the repository.
2. Navigate to the project directory.
3. Install the dependencies.
```bash
npm install
```
## Configuration
The API uses environment variables for configuration.
## Usage
To start the API, use the following command:
```bash
npm start
```
The API will be available by default at http://localhost:3000.
## Endpoints
### GET /api/bookings
Retrieve a paginated list of bookings.
**Query Parameters:**
- `page`: Page number (default is 1).
- `limit`: Number of bookings per page (default is 12).
- `startDateTime`: (Optional) Filter bookings that start on or after this date and time.
- `endDateTime`: (Optional) Filter bookings that end on or before this date and time.
- `filter`: (Optional) Predefined date filters such as today, tomorrow, or this_week.
**Example Request:**
Retrieve bookings for today:
```bash
curl http://localhost:3000/api/bookings?filter=today
```
Retrieve bookings for a specific date range:
```bash
curl http://localhost:3000/api/bookings/?startDateTime=2024-08-10T00:00:00&endDateTime=2024-08-10T23:59:59
```
**Response:**
- `200 OK`: JSON object containing the list of bookings.
- `500 Internal Server Error`: If there is an error reading the booking data.
### GET /api/booking/single
Retrieve details of a single booking by its bookingId.
**Query Parameters:**
- `bookingId`: The ID of the booking to retrieve (required).
**Example Request:**
```bash
curl http://localhost:3000/api/booking/single?bookingId=1234
```
**Response:**
- `200 OK`: JSON object containing the booking details.
- `400 Bad Request`: If `bookingId` is not provided.
- `404 Not Found`: If the booking with the specified bookingId is not found.
- `500 Internal Server Error`: If there is an error reading the booking data.
## License
This project is licensed under the ISC License. See the LICENSE file for more details.