Skip to content

Latest commit

 

History

History
60 lines (44 loc) · 1.82 KB

README.md

File metadata and controls

60 lines (44 loc) · 1.82 KB

Travel Expenses REST API

The Travel Expenses REST API is a full-stack web application designed to manage group expenses for travelers. The API is built with Node.js, Express.js, and Mongoose for MongoDB integration, and features a set of endpoints to manage travelers and activities.

Features

  • Create, modify, retrieve, and delete traveler(s) and activity(ies) data.
  • Organized file structure for easy maintainability.
  • Built using Express.js, Node.js, and Mongoose for MongoDB integration.

Getting Started

These instructions will help you set up and run the Travel Expenses REST API on your local machine.

Prerequisites

  • Node.js (v14 or later)
  • npm (v6 or later)
  • MongoDB (local or remote)

Installation

  1. Clone the repository:
git clone https://github.com/Abdirahim888/travel-expenses-server.git
cd travel-expenses-server
  1. Install the required dependencies:
npm install
  1. You will need to set up your Atlas URI connection:
ATLAS_URI=mongodb+srv://<username>:<password>@sandbox.jadwj.mongodb.net/myFirstDatabase?retryWrites=true&w=majority

Running the API

npm start

The API will be accessible at http://localhost:3000/api/v1/

API Endpoints

The following endpoints are available for travelers and activities. Replace :model with either traveler or activity.

Travelers / Activities

GET /:model: Retrieve a specific traveler/activity by query parameters.
GET /:model/:_id: Retrieve a specific traveler/activity by ID.
GET /:model/all: Retrieve all travelers/activities.
POST /:model: Create a new traveler/activity.
POST /:model/all: Create multiple travelers/activities.
PUT /:model: Update a specific traveler/activity by query parameters.
DELETE /:model/:_id: Delete a specific traveler/activity by ID.
DELETE /:model/all: Delete all travelers/activities.