Answer the question
In order to leave comments, you need to log in
How to implement such a filter?
I think for many the question is banal.
There is a database of 1000 items and 10 attributes. The user performs a test on the site (that is, the test is a filter, a web application) and the site produces a filtered result suitable for the request based on the answers. Is it possible to implement this with js or do you need a backend and how difficult is it?
Answer the question
In order to leave comments, you need to log in
You will love to have a server, you operate the database. Organize a REST API on the server that will give you content. Let's say make the router host:80/api/search. You simply make a get request to this router and pass filters to this api, the api makes a request to the database and returns everything to the client, and the client renders all the incoming data. It is better to use a post request, there are no restrictions on the amount of data in it. This is not a difficult task, I’ve been doing this lately)
Everything is very convenient, the server gives the application itself at the root and it already makes requests to the api, you can also file the admin panel)
Well, either look for a fork frame to work with local storage and save everything data in it, and then synchronize, but this is more complicated.
You say that a DB - means and it is necessary to do at the backEnd level.
If there is really not much data, then either create an object, or get it from csv and use filter js.
For example newObject = oldObject.filter(function(a){
a.name == NAME &&
a.age >= AGE
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question