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

Make LocalStorage mechanism #14

Open
ans-4175 opened this issue Nov 11, 2021 · 7 comments
Open

Make LocalStorage mechanism #14

ans-4175 opened this issue Nov 11, 2021 · 7 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@ans-4175
Copy link
Owner

Then: scrape handful of data (500ish each or 100Kb), put it in direct file in this app, call it from password-ga-kata, to check its randomness etc

Now: add more words (optional) then store somewhere else endpoint, make this app fetch it and store in localstorage, password-ga-kata should query from localstorage (change from direct access/flatfiles to localstorage)

Next: Scrape all data, discuss how many it would be if chunked for 100Kb (TBD) each, create mechanism for app to download wordpack and store it in localstorage

Why localstorage tho? I think we could improve it as PWA for next improvement, so that app could run standalone (only fetch new wordpacks/chunks)

Originally posted by @ans-4175 in #9 (comment)

@ans-4175 ans-4175 added enhancement New feature or request help wanted Extra attention is needed labels Nov 11, 2021
@imballinst
Copy link
Collaborator

imballinst commented Nov 12, 2021

@ans-4175 are we settling with JSONBin for this iteration? Other approach that I could think of is to use Netlify to serve it. We can do this:

curl https://suspicious-wozniak-66e0f6.netlify.app/.netlify/functions/server

Then it will return the dictionary that we have right now. Compared to JSONBin, Netlify has 125k requests limit (of functions) per month compared to JSONbin 10k all time. I'm using https://github.com/neverendingqs/netlify-express/blob/master/express/server.js as the reference.

@ans-4175
Copy link
Owner Author

I think JSONBin would be suffice for now, for just trying to make fetch for localstorage?
With netlify we should make another repos right @imballinst ?

@imballinst
Copy link
Collaborator

@ans-4175 yeah, we kinda have to make this an actual monorepo the very least (using a different base folder), but that would be overkill, on a second thought.

Should I create the JSONBin and put the list of words there? If so, I'll do it and then I'll iterate the next PR.

@ans-4175
Copy link
Owner Author

Neat, I already set it up on https://api.jsonbin.io/b/618e0782820eda3cc81c3105
Just similar with words.json. After this issues validated, we could think for furthers.
But I think we should fix #2 and #15 first before moving to this one @imballinst ?

So that #14 and #3, will be in next version?

@imballinst
Copy link
Collaborator

Sounds good, let's get #2 and #15 finished first @ans-4175 👍

@ans-4175
Copy link
Owner Author

So basic logic on localStorage

  • check whether storage exist
  • if not, fetch from endpoint, store it
  • if both yes/not, fetch all from storage, then put it as constant
  • doing as usual

is that correct?

@imballinst
Copy link
Collaborator

Yes @ans-4175, that sums up neatly ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants