NivaldoFarias / valex-api

18ᵗʰ Project developed during Driven's Full Stack Develpment Bootcamp

Home Page:https://valex-project-api.herokuapp.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


Logo

Valex API

WIP

Back end Development Project {18ᵗʰ}
Browse TypeScript code»

Built With

Table of Contents

Getting Started

This Api can be used in two different ways: by cloning the project or by using your preferred client, such as Insomnia or Postman.

To clone the project, run the following command:

git clone https://github.com/NivaldoFarias/valex-api.git

Then, navigate to the project folder and run the following command:

npm install

Finally, start the server:

npm start

You can now access the API's endpoints by navigating to http://localhost:5000/ or to the deployed URL https://valex-project-api.herokuapp.com/. If needed, import one of the provided Request Collections files into your preferred client and test the endpoints!

ps.: Highly recommend using the request collections to test the API.

API Reference

In this section, you will find the API's endpoints and their respective descriptions, along with the request and response examples. All data is sent and received as JSON.

Routes

Cards /cards

Payments /payments

Recharges /recharges

Cards

  ‣   Create a card

    POST /cards/create

  ☰   Request

Body
{
  "employeeId": "1",
  "cardType": "health"
}
Headers
{
  "Content-Type": "application/json",
  "x-api-key": "this-is-a-needlessly-long-placeholder-api-key"
}

  ☰   Responses

Status Code Description Properties
201 Created data: { securityCode }
400 Missing Headers error: { message, details }
401 Unauthenticated error: { message, details }
403 Forbidden error: { message, details }
404 Not Found error: { message, details }
422 Invalid Input error: { message, details }
500 Internal Server Error error: { message, details }

  ‣   Activate a card

    POST /cards/activate

  ☰   Request

Body
{
  "cardId": "3",
  "securityCode": "616",
  "password": "1234"
}
Headers
{
  "Content-Type": "application/json"
}

  ☰   Responses

Status Code Description Properties
200 OK data: {}
403 Forbidden error: { message, details }
404 Not Found error: { message, details }
422 Invalid Input error: { message, details }
500 Internal Server Error error: { message, details }

  ‣   Block a card

    POST /cards/block

  ☰   Request

Body
{
  "cardId": "3",
  "password": "1234"
}
Headers
{
  "Content-Type": "application/json"
}

  ☰   Responses

Status Code Description Properties
200 OK data: {}
403 Forbidden error: { message, details }
404 Not Found error: { message, details }
422 Invalid Input error: { message, details }
500 Internal Server Error error: { message, details }

  ‣   Unblock a card

    POST /cards/unblock

  ☰   Request

Body
{
  "cardId": "3",
  "password": "1234"
}
Headers
{
  "Content-Type": "application/json"
}

  ☰   Responses

Status Code Description Properties
200 OK data: {}
403 Forbidden error: { message, details }
404 Not Found error: { message, details }
422 Invalid Input error: { message, details }
500 Internal Server Error error: { message, details }

Payments

  ‣   New payment

    POST /payments/new

  ☰   Request

Body
{
  "card": {
    "id": 3,
    "password": "1234"
  },
  "businessId": 5,
  "amount": 1000
}
Headers
{
  "Content-Type": "application/json"
}

  ☰   Responses

Status Code Description Properties
201 Created data: {}
403 Forbidden error: { message, details }
404 Not Found error: { message, details }
422 Invalid Input error: { message, details }
500 Internal Server Error error: { message, details }

Recharges

  ‣   New recharge

    POST /recharges/new

  ☰   Request

Body
{
  "cardId": 3,
  "amount": 1000
}
Headers
{
  "Content-Type": "application/json",
  "x-api-key": "this-is-a-needlessly-long-placeholder-api-key"
}

  ☰   Responses

Status Code Description Properties
201 Created data: {}
400 Missing Headers error: { message, details }
401 Unauthenticated error: { message, details }
403 Forbidden error: { message, details }
404 Not Found error: { message, details }
422 Invalid Input error: { message, details }
500 Internal Server Error error: { message, details }

Contact & Study Playlist

In the following Youtube link I included all Youtube content I used or refered to while studying for this project. Hope you enjoy it!

LinkedIn Slack Youtube

About

18ᵗʰ Project developed during Driven's Full Stack Develpment Bootcamp

https://valex-project-api.herokuapp.com/

License:MIT License


Languages

Language:TypeScript 99.5%Language:Shell 0.5%