/traidr

Traidr is a marketplace API that allows users to seamlessly buy and sell products. Users can place orders, upload products, and interact with each other through comments and images

Primary LanguageRuby

Marketplace API Project - Traidr

Table of Contents

About

Traidr is a marketplace API that allows users to seamlessly buy and sell products. Users can basically create their own store upload products to sell or place orders on the platform.

Usage

  • Test the API thorough this Swagger Interactive Docs - here
  • You can also find the API Specifications Docs here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

ruby
rails
postgres

Setting up a development environment

Step 1: Clone the repository

git clone https://github.com/benessilfie/traidr.git

or with Github CLI

gh repo clone benessilfie/traidr

Step 2: Run Bundle install

bundle install

Step 3: start the server

rails start

Test the API (Locally)

  • You can either go to the interactive swagger documentation locally at http://api.lvh.me:3000/v1/docs or the deployed version here

  • Alternatively you can also use the API testing tool of your choice. You'll find the API documentation with the base URL and various endpoints here

Example

Creating a user account

  • curl
curl --request POST \
  --url https://traidr.onrender.com/api/v1/users \
  --header 'Content-Type: application/json' \
  --data '{
    "user": {
      "email": "test@example.com",
      "password": "password"
    }
  }'
  • httpie
http https://traidr.onrender.com/api/v1/users \
user:='{"email":"test@example.com","password":"password"}'
{
    "user": {
        "email": "test@example.com",
        "password": "password"
    }
}

Response

{
    "data": {
        "id": "1",
        "type": "user",
        "attributes": {
            "email": "test@example.com"
        },
        "relationships": {
            "products": {
                "data": []
            }
        }
    }
}

Run the Mini Tests

To run the tests, just run the rails test command

rails test

Author

Benjamin Essilfie Quansah