+ 3
how to count number of likes?
I have extracted data from a json api and implemented a button to like each item using cookies. how do I count the number of likes so that I can display the top 10 liked items?
6 odpowiedzi
+ 3
Xixi You're welcome. Have you written any server code before? If you have, it might be good to go with that since you already know some. If you haven't, I'd recommend Node since you obviously already know some JavaScript.
Python might be a good option because like Node/JavaScript, it has a big community. I don't really know Python but it's supposed to be fairly quick to learn the basics.
Another couple of candidates are PHP and Ruby on Rails.
+ 2
Jan Markus I like the way you think.
+ 2
CamelBeatsSnake thanks
do you have any suggestions which language to implement the server side in?
+ 1
It sounds like you need to store some state. It sounds like you need a feature where you need to know about all the likes from all your users, then use that data to generate a ranking that all users can see.
If I'm right in thinking that's why you want to do, you'll need your own server side solution. Basically, it can't just be a client-side solution because you need to send out the ranking info to all your users.
One approach is every time any user presses like on any item, a request is made to an API which handles adding the like to the item. When the application loads in the client (browser), it'll have to make a request to get all the like data so that it can display them in the right order according to the ranking.
+ 1
CamelBeatsSnake ooh ok. thanks a lot!
I'll look into those
I know python but haven't done any for the purposes of web dev