I wanna use the json file as a DB instead of having the question and answers from which on to be correct in JS.
I have ended up to the point where I don’t know how to make the connection between. If I wanna have 1000 words, is a lot of work to type each question with 4 answers and also to shuffle them.
Any idea?Hints?
Here you can find all my code.
https://gist.github.com/maruscav/aee832dad0ab78f08896ad832f1066e6
2
Answers
From what I understand, JSON wouldn’t be used as a DB. Unsure what you’re using for your DB at the moment, but firebase, Amazon Web Services, or SQL Server could be used for a DB.
You can’t access server-side data directly without a web server (for example, a Node or Python or C# app running on a server). There are some exceptions, but they’re somewhat complex. Find a tutorial on writing a web server and experiment (since you know some JavaScript, writing a web server with Node and Express might be the most straightforward option).
If you want to use JSON as a client-side store (in-browser, not persisted to a server), you can use localStorage.
And please don’t post links to code, post the actual relevant code in your question.