Skip to content

bruch0/myWallet-API

Repository files navigation

MyWallet API

Documentation 🧾

Sign up

POST /sign-up

Expected body

{
  name: String, at least 3 characters,
  email: String, at least 5 characters, must be a valid email,
  password: String, at least 8 characters, does not differentiate upper and lower cases,
}

Expected headers

None, this is a public route

Possible response status

- 400: You have sent a invalid body or your body does not match the criteria,
- 409: This email is already registered
- 201: Account created

Sign in

POST /sign-in

Expected body

{
  email: String, at least 5 characters, must be a valid email,
  password: String, at least 8 characters, does not differentiate upper and lower cases,
}

Expected headers

None, this is a public route

Possible response status

- 400: You have sent a invalid body or your body does not match the criteria,
- 404: This email is not registered
- 401: Invalid password
- 200: Logged successfully

Get transactions

GET /transactions

Expected headers

{
  headers: {
    authorization: Bearer token
  }
}

Possible response status

- 401: You are not logged or your token is invalid
- 200: Success

What you will receive from this route

{
  transactions: Array;
}

Register transaction

POST /transactions

Expected body

{
  value: String, at least 1 character,
  description: String, at least 5 characters,
  type: String, must be either 'input' or 'output',

Expected headers

{
  headers: {
    authorization: Bearer token
  }
}

Possible response status

- 400: You have sent a invalid body or your body does not match the criteria,
- 401: You are not logged or your token is invalid
- 200: Success

How to run in your machine 🖥️

git clone https://github.com/bruch0/myWallet-API.git
cd myWallet-API
npm i --force

Create a .env.dev file and fill it using your environment variables following this example

In your terminal

sudo su postgres
psql
CREATE DATABASE mywallet
\c mywallet

Copy everything in the dump.sql file and paste on the terminal
You can not exit the postgres admin, and run

npm run dev

How to run the tests in your machine 🖥️

Create a .env.test file and fill it using your environment variables following this example

In your terminal

sudo su postgres
psql
CREATE mywallet_test;
\c mywallet_test

Copy everything in the dump.sql file and paste on the terminal

You can not exit the postgres admin, and run

npm run tests

Deployment 🚀

You can check the server running on heroku here!


Contact

Gmail Badge Linkedin Badge

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors