Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎲 No Randomization on different endpoints #4

Closed
ABSphreak opened this issue Aug 20, 2020 · 28 comments
Closed

🎲 No Randomization on different endpoints #4

ABSphreak opened this issue Aug 20, 2020 · 28 comments
Labels
hacktoberfest Hacktoberfest contributions welcomed! help wanted Extra attention is needed

Comments

@ABSphreak
Copy link
Owner

Jokes are not randomizing on different endpoint requests.

@ABSphreak ABSphreak added the help wanted Extra attention is needed label Aug 22, 2020
@PiyushSuthar
Copy link

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.

@ABSphreak
Copy link
Owner Author

Good idea @PiyushSuthar, will work on it, also, I'm thinking of customization parameters too, like in github-readme-stats

@ABSphreak ABSphreak added the hacktoberfest Hacktoberfest contributions welcomed! label Oct 7, 2020
@karmanya007
Copy link
Contributor

Could try to solve this problem, if no one is actively working on it.

@ABSphreak
Copy link
Owner Author

You can work on it @karmanya007 I can assign it to you.

@karmanya007
Copy link
Contributor

Bro do you want to get a new joke every time you GET the /api endpoint??

@karmanya007
Copy link
Contributor

Or do you want some caching time?

@ABSphreak
Copy link
Owner Author

@karmanya007 both would be fine,
for now, make it so that get a new joke every time you GET the /api endpoint.

@karmanya007
Copy link
Contributor

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.

@ABSphreak
Copy link
Owner Author

Keep this logic, we can set the cache age to any desired value, right?

@karmanya007
Copy link
Contributor

Yup.

@ABSphreak
Copy link
Owner Author

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.

@karmanya007
Copy link
Contributor

Works on the Vercel instance. PR opened.

@ABSphreak
Copy link
Owner Author

ABSphreak commented Oct 9, 2020

@karmanya007 I think randomization is not working, or is it working after 60 seconds?

@karmanya007
Copy link
Contributor

after 60 seconds

@ABSphreak
Copy link
Owner Author

@karmanya007 nice work.

@ABSphreak ABSphreak changed the title 🎲 No Randomization 🎲 No Randomization on different endpoints Oct 9, 2020
@karmanya007
Copy link
Contributor

This issue is fixed, right?

@ABSphreak
Copy link
Owner Author

ABSphreak commented Oct 9, 2020

@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.

@karmanya007
Copy link
Contributor

@ABSphreak If everyone creates there own vercel instance, then this issue would be fixed. (Like in the github-readme-stats)

@ABSphreak
Copy link
Owner Author

ABSphreak commented Oct 9, 2020

@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.

@karmanya007
Copy link
Contributor

I think i can implement this feature.

@ABSphreak
Copy link
Owner Author

@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.

@karmanya007
Copy link
Contributor

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?

@ABSphreak
Copy link
Owner Author

@karmanya007 yes.
Different user endpoints, different jokes.

@karmanya007
Copy link
Contributor

But the thing is, I didn't change anything in the code. This is what I was talking about before.

@ABSphreak
Copy link
Owner Author

ABSphreak commented Oct 11, 2020

@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? 🤔

@karmanya007
Copy link
Contributor

@ABSphreak On the same device, the jokes are same but on requests from different devices the endpoint get different data.

@ABSphreak
Copy link
Owner Author

@karmanya007 okay, then I think we should close this one and open a new one for making endpoints get user inputs I guess.

@karmanya007
Copy link
Contributor

Yup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest Hacktoberfest contributions welcomed! help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants