My Wallet API

🔍 About

This is the back-end repository of My Wallet, a web application that helps you control your daily expenses


🏛️ Front-end repository

My Wallet APP


🛰️ Deployment

My Wallet


🚂 How to run

Pre-requisites: Git and Node.js


# Clone this repository
$ git clone <https://github.com/victordurco/api-my-wallet>

# Access the project folder cmd/terminal
$ cd my-wallet-api

# Install the dependencies
$ npm install

# Create a dev postgres database using the dump.sql file (the following command can be used in the postgres terminal if you are using ubuntu and put the dump.sql file in the /tmp folder)
pg_dump your_database_name < /tmp/dump.sql


# Create a file of environment variables at the root of the project
$ touch .env.dev

# Set the database port and link as environment variable according to the ".env.example" file

# Run the app
$ npm run start:dev

# The server will automatically start on your localhost

# Run the tests
$ npm run test

📜 Documentation

POST /sign-up

Request

body: {
    "name": "Marina",
    "email": "marinasena@gmail.com",
    "password": "De1primeira!",
}

Response

in case of invalid params: status 400

in case e-mail already exists: status 409

in case of success: status 201

POST /sign-in

Request

body: {
    email: marinasena@gmail.com,
    password: De1primeira!
}

Response

in case of invalid params: status 400

in case of incorrect e-mail and/or password: 401

in case of unregistered email: 404

in case of success: status 200

    data: {
        "name": "Marina",
        "token": "ad52a74s3f54a32d",
    }

POST /sign-out

Request

headers: {
  Authorization: Bearer token
}

body: {}

Response

in case of success: status 200

GET /registers

Request

headers: {
  Authorization: Bearer token,
}

Response

in case of unauthorized session: 401

in case of success: status 200
    body: {
        [array of registers]
    }

POST /registers

Request

headers: {
  Authorization: Bearer token,
}

body: {
    value: 500000, //in cents
    description: "salario",
    type: 1 //only accepts 1 (for Entry) or 2 (for Exit)
}

Response

in case of unauthorized session: 401

in case of invalid body: status 400

in case of success: status 201

POST /registers/delete

Request

headers: {
  Authorization: Bearer token,
}

body: {
    id: 52 //id of the register tha must be deleted
}

Response

 in case of success: status 204

🧮 Tech Stack

javascript postgres nodejs npm jest expressjs heroku