Skip to content

Repository files navigation

AirbNC

API Guide: Available Endpoints & Usage

API Guide: Available Endpoints & Usage

Below is a screenshot showing the API request and response in Postman:

Postman GET /users

AirbNC is a RESTful backend API for a property rental application. Built with Node.js, Express, and PostgreSQLThe API supports property listings, user management, bookings and reviews, and provides the backend services for the AirbNC React frontend.

Database: PostgreSQL / Supabase Deployment: Render

The frontend is maintained in a separate repository. Link: https://github.com/sandra395/AirbNC-frontend

✨ Features

🏠 Property listings and property management 👤 User management 📅 Booking functionality ⭐ Property reviews 🔗 RESTful API endpoints 🗄️ PostgreSQL database integration 🧪 Unit and integration testing

🛠️ Tech Stack

Node.js | Express.js | PostgreSQL | Supabase | Jest | REST API

Backend

Node.js - server-side JavaScript runtime Express.js - REST API framework PostgreSQL - relational database Supabase - hosted PostgreSQL database Jest - unit and integration testing

API Architecture

The API follows a RESTful, resource-based architecture using standard HTTP methods and structured endpoints.

📡 API Guide

The API provides endpoints for resources including:

Users | Properties | Bookings | Reviews

API requests can be tested using Postman.

Example API Request

Example GET /users request and response:

💪 Getting Started

1. Install Dependencies

Install all project dependencies:

npm install

2. Create Local Databases

Create two local databases: airbnc_test and airbnc. A setup script is provided:

npm run setup-dbs

3. Set Up environment variables

Create the required .env.test and .env.development files.

.env.test

PGDATABASE=airbnc_test

.env.development

PGDATABASE=airbnc

Make sure environment files are included in .gitignore.

4. Seed the Databases

The test database is automatically seeded when running the test suite.

To seed the development database, run:

npm run seed

5. Start the Server

Start the server locally:

npm run dev

Then open http://localhost:9090 in your browser or an API client (e.g., Postman) to explore the endpoints.

6. Run Tests

Once the databases are ready, run:

npm test

Try the Live API

The AirBNC backend is deployed and live at: https://portfolio-xxtl.onrender.com

Feel free to test endpoints directly from this URL—no local setup required.

🔗 Related Project

AirbNC Frontend (https://github.com/sandra395/AirbNC-frontend)

The React frontend consumes this API to provide the complete property booking experience.

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages