This is the back-end repository of My Wallet, a web application that helps you control your daily expenses
# 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
body: {
"name": "Marina",
"email": "marinasena@gmail.com",
"password": "De1primeira!",
}
in case of invalid params: status 400
in case e-mail already exists: status 409
in case of success: status 201
body: {
email: marinasena@gmail.com,
password: De1primeira!
}
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",
}
headers: {
Authorization: Bearer token
}
body: {}
in case of success: status 200
headers: {
Authorization: Bearer token,
}
in case of unauthorized session: 401
in case of success: status 200
body: {
[array of registers]
}
headers: {
Authorization: Bearer token,
}
body: {
value: 500000, //in cents
description: "salario",
type: 1 //only accepts 1 (for Entry) or 2 (for Exit)
}
in case of unauthorized session: 401
in case of invalid body: status 400
in case of success: status 201
headers: {
Authorization: Bearer token,
}
body: {
id: 52 //id of the register tha must be deleted
}
in case of success: status 204