๐ฒ No Randomization on different endpoints
ABSphreak opened this issue ยท 28 comments
Jokes are not randomizing on different endpoint requests.
Here's what I have thought.
Each person can have their own username as their parameter.
Example
![Jokes Card](https://readme-jokes.vercel.app/api?piyushsuthar)
This will make each request unique.
Good idea @PiyushSuthar, will work on it, also, I'm thinking of customization parameters too, like in github-readme-stats
Could try to solve this problem, if no one is actively working on it.
You can work on it @karmanya007 I can assign it to you.
Bro do you want to get a new joke every time you GET the /api endpoint??
Or do you want some caching time?
@karmanya007 both would be fine,
for now, make it so that get a new joke every time you GET the /api
endpoint.
Right now I have implement a cache age of 60 seconds i.e the jokes update after 60 seconds of reloading the endpoint. If you want I can keep this logic or make the cache age to 0.
Keep this logic, we can set the cache age to any desired value, right?
Yup.
Cool, then I think it should be good, ensure that it'll work on vercel instance after production and then open up a PR, I'll merge.
Works on the Vercel instance. PR opened.
@karmanya007 I think randomization is not working, or is it working after 60 seconds?
after 60 seconds
@karmanya007 nice work.
This issue is fixed, right?
@karmanya007 no, not really, this issue is for serving different endpoint requests for different users, they should get different jokes each time also, theming is going to be added soon so that would have to address this issue itself.
You solved #2
I mentioned to you there too.
@ABSphreak If everyone creates there own vercel instance, then this issue would be fixed. (Like in the github-readme-stats)
@karmanya007 point of this project is to provide a customized readme-joke card, even if the user doesn't have the knowledge of Vercel or serverless.
The solution is simple, as pointed out above by Piyush, please read message threads and follow github-readme-stats for more details, it has many users, Vercel deployment instructions are for people who want to develop over it or don't want to use the default endpoint provided by the repo, so those people can create their own Vercel instance and play with the project to suit their needs.
Also, not many people would create a Vercel instance just for serving jokes, LoL.
I think i can implement this feature.
@karmanya007 go ahead, try it. I'm just not very active on this repository, but I am watching all the contributions on it.
If you think you can implement this feature, go ahead.
The request I make on my pc gives me different jokes as compared to the jokes i get on my phone. Is this what you wanted?
@karmanya007 yes.
Different user endpoints, different jokes.
But the thing is, I didn't change anything in the code. This is what I was talking about before.
@karmanya007 Try hitting this endpoint in two different tabs https://readme-jokes.vercel.app/api,
it'll show you the same result, btw, I have turned down the CACHE_CONTROL
to 10 seconds, that's why it's changing rapidly.
Endpoint requests are not unique.
I want something like:
https://readme-jokes.vercel.app/api?user=<username1>&theme=<theme1>
https://readme-jokes.vercel.app/api?user=<username2>&theme=<theme2>
both unique endpoints serving different kinds of data.
Also, if you check my Profile README & endpoint at the same time, it's showing different results, so maybe it's working? ๐ค
@ABSphreak On the same device, the jokes are same but on requests from different devices the endpoint get different data.
@karmanya007 okay, then I think we should close this one and open a new one for making endpoints get user inputs I guess.
Yup