Skip to content
Caroline Oliveira edited this page Apr 4, 2022 · 1 revision

MyWallet documentation

Sign Up

POST request to /sign-up sending on the body

   {
    	email: "...",
    	name: "...",
    	password: "..."
   }

Login

POST request to /login sending on the body

    {
    	email: "...",
    	password: "..."
    }

The server will respond with the object

    {
    	"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MywiaWF0IjoxNjIxMjg0NzExfQ.b8e3bYm7TnU5p6pfrCPPbzboax6gvh_gGNFR4T51FxY",
    	"name": "Joe"
    }

Logout

DELETE request to /logout sending a header Authorization with the Bearer TOKEN format

List all the records

GET request to /records sending a header Authorization with the Bearer TOKEN format

The server will respond with the object

    [
    	{
    		id: new ObjectId("61ff487352dd6f68254b93a7"),
    		amount: "2000",
    		description: "Salary",
    		type: "income",
    		date: "06/02",
    		userId: "61ff484952dd6f68254b93a2"
    	},
    	{
    		id: new ObjectId("620e828737614311da58f243"),
    		amount: "300",
    		description: "Groceries",
    		type: "expense",
    		date: "07/02",
    		userId: "61ff484952dd6f68254b93a2"
    	}
    ]

Add a new record

POST request to /records sending on the body

    {
    	"amount": "2000",
    	"description": "Salary",
    	"type": "income"
    }

and a header Authorization with the Bearer TOKEN format

Delete a record

DELETE request to /records/RECORD_ID sending a header Authorization with the Bearer TOKEN format and replacing RECORD_ID with the id of the record that will be deleted

Update a record

PUT request to /records/RECORD_ID sending a header Authorization with the Bearer TOKEN format and replacing RECORD_ID with the id of the record that will be updated## #

Clone this wiki locally