3rd requirement is unclear
ZhKas opened this issue · 19 comments
I didn't fully understand the requirement "3. Distribute requests between variants".
So, I don't have to show different pages to a single user every time(as it's said "when a client makes a request to the Workers script, the script should roughly return each variant"), so I don't have to use cookies for this. Is seems like it's enough just to remember user and count each of 2 urls, or I could use round-robin method, 'cause each of these will give 50% probability. I know that using cookies is extra-credit task "2. Persisting variants
", but I'd like to do both ways :)
I didn't really understand it either tbh, but I'm assuming that if you're using a random function between two numbers, it should be roughly 50/50.
Requirement 3 is asking for you to return the variants evenly.
So if I go to your site 1000 times, I should expect to get each variant 500 times.
A good way to do this, like @kungpaogao mentioned, is utilizing a random function.
I suppose you could also do it your way and just keep count of the amount of users that call the script. But that takes up some unnecessary storage space and it's something extra to keep track of.
Cookies is extra credit. But you should still be distributing each variant 50% of the time. The only difference that cookies should make is that if I visit your site again, it'll get the same variant every time. (i.e. if I visit your site, I'll have a 50% chance to get either variant. If I visit again, I only get the variant I got the first time)
I could not install wrangler on my Mac, anyone could help?
Thanks a lot.
@MYANH2020 could you provide some more information about what you've tried already? Do you have npm
installed?
@MYANH2020 what are the errors?
I could not install wrangler on my Mac, anyone could help?
Thanks a lot.
Read through issue #3 and see if you're able to install after reading through those comments.
If you're still not able to, create a new issue.
@MYANH2020 Please try to install nvm
(https://github.com/nvm-sh/nvm), and then use nvm to install nodejs. Remember to source the .bashrc
after you are done installing (if you are using BASH). This should solve the permissions problems. If that somehow didn’t work, please post the full error log here so we can help you further.
I could not install wrangler on my Mac, anyone could help?
Thanks a lot.
Check out this link: cloudflare/wrangler-legacy#240
Look at the answer from @younggrandpa
It worked for me.
I could not install wrangler on my Mac, anyone could help?
Thanks a lot.
@MYANH2020
First check whether you have node installed
node -v
if not then install on mac using Homebrew
brew install node
then use
npm i @cloudflare/wrangler -g
to install wrangler
I hope it helps😅
I could not install wrangler on my Mac, anyone could help?
Thanks a lot.Check out this link: cloudflare/wrangler#240
Look at the answer from @younggrandpa
It worked for me.
Thanks a lot it worked for me, too.
But how to generate the project? I follow the code " workers $ wrangler generate my-worker" but it does not work.
But how to generate the project? I follow the code " workers $ wrangler generate my-worker" but it does not work.
Check if wrangler is installed
wrangler
To generate a project
wrangler generate <projectname>
wrangler generate
error: -bash: syntax error near unexpected token `newline'
wrangler generate
error: -bash: syntax error near unexpected token `newline'
wrangler generate your-project-name https://github.com/cloudflare-internship-2020/internship-application-fullstack
wrangler generate
error: -bash: syntax error near unexpected token `newline'
wrangler generate your-project-name https://github.com/cloudflare-internship-2020/internship-application-fullstack
Thanks for help.
Impossible to install Wrangler on newest Fedora without throwing errors when starting it
/usr/local/lib/node_modules/@cloudflare/wrangler/node_modules/binary-install/src/binary.js:60
throw `You have not installed ${this.name ? this.name : "this package"}`;
^
You have not installed wrangler
@kulxtreme I recommend you try using nvm
to install your nodejs env, then install wrangler again