Personal Budget I ( the phantom envelope )

My Personal Vision of Personal Budget :slight_smile:

Am I the first one to post it ?

Et voilà !

Some points I want to share, it was quite difficult to set up the api, I mean about the skeleton
I have set too much dependecies and I’m afraid to delete somes, I think that could break the api

Also I didn’t set any Front End, in the back end course ther is not much informations about how to do that. I hope I’m gonna to find more informations about express templates like Pug in the next lessons.

Anyway it was fun to set up the endpoints and see all this stuff running as well ! Also I’m a friend of Postman now, I think there’s much more to do with but it’s a good start.

Feel free to check my work and add some comments also you can find me on Discord channel, just looking for François :wink:

Cheers !

Hi! I just finished this project myself and checked out your API.

Most seems to work good! Only one thing struck me as odd, when updating an object I think you should use PUT instead of POST. But it seemed to work fine, so functionaliy wise no problem.

Also you’re requiring body-parser but not using it as far as I can tell!

Good job!

BR,
Christoffer

1 Like

Hello!

So, I did some research about when to use PUT and POST since both are used to update.
The summary is that you should use PUT when you need the action to be idempotent, which means doing several requests continuously will not change the outcome, for example x=5 (assigning the value 5 to variable x).
And use POST when is the contrary, so an example would be x++;
I am not expert but I had the same questions and I wanted to share my findings. I hope is clear!

Hi!

I thought this was basic. In the course it says PUT is used for updating resources (both x=5, x++ could be updating it), and POST to create a new resource that didnt exist earlier (x=5, if x didn’t exist before).
Is it used in other ways in the real world?

BR,
Christoffer

I am not sure. I just did the research since they put a hint in that project that talk bout whether to use PUT or POST depending on how you were updating the balance on the envelopes.

Heya !
I am not an expert neither but if I understand correctly, POST and PUT are similar.
POST is used for creating and PUT for updating in the REST API guidelines but it is up to you to use it as you wish.
I followed the hint and used POST for updating the enveloppe.
What does it worth ? I don’t know.