This is the API with which the My Wallet App interacts.
Not needed but recommended: VSCode
This API was designed to work with My Wallet App
Use a terminal interface such as bash or zsh, and enter the following:
#download
gh repo clone fMagVen/myWallet_BackEnd
#access the folder you downloaded it to
cd myWallet_BackEnd
#install dependencies
npm iThe app will run locally and you must configure a .env file with a port of your choosing. The default one is 3000.
#you can run the server with
node index.jsIn another terminal instance, run the db
#you can start the db with
mongod --dbpath ~/.mongoTo signup, send a post request to /auth/signup with a JSON with the following keys and values: name: your name email: your email password: enter a password confirmPassword: repeat the password from the previous key
To login, send a post request to /auth/login with a JSON with the following keys and values: email: the email you registered with password: your account's password
The API will return a token which will be used to authenticate every screen swap and transaction, to use it, please send a header with the following:
{ Authorization: Bearer <token> }Where is the token sent by the server
To see transactions, use the header described above and send a get request to /transactions/all
To add a new transaction, send a post request to /transactions/new with the header above and a body with the following keys and values:
value: The value of your transacion. Integer numbers only. Please use only cents, their value are automatically corrected by factor 100. E.g.: if you want to add $5.00, enter 500 description: A description of what kind of transaction it is expense: true if it is an expense, false if it is an income
To delete an existing transaction, send a post request to /transactions/del, use the same keys and values above, with the header, and add this key with value, before all others: id: the id of your transaction, returned by the get /transactions/all request
and this key and value, after all others:
UserId: your id in the db, returned by the post auth/login request
To modify an existing transaction, send a post request to /transactions/mod, same keys and values of the deletion request.
Made with care by
Contact me anytime!