Hi campers,
For the Stock Price checker project under Info Sec, one of the requirements is that users can only ‘like’ a stock once, for each different IP. I found the user IP via the req.header[‘x-forwarded-for’], and it seems like 1 possible solution for this challenge is to store the IP number for each ‘like’, for each stock in the Mongoose database. Then, every time there is a ‘like’ input, the get handler checks the stock document to see if there’s already an IP in the array, to see if the ‘like’ should be incremented.
I’m curious if there’s another way to go about this, so that the ‘like’ is only incremented for each unique IP, without storing the IP information in the database. (but I don’t see how that is possible without all the IP data being stored somewhere). Thanks!