Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Searching at frontend vs backend in NodeJS

I am developing a web application using NodeJS & SailsJS frameworks. Now I am going to develop searching functionality. There are around 5000 records from which I want to search on one attribute.

I know I can search it using mogodb query. What if I get all the records in javascript at frontend and search from it? What is good way to search? At backend using db query or at fronend using javascript searching?

like image 678
user3759750 Avatar asked May 30 '16 11:05

user3759750


People also ask

Is Nodejs backend or front end?

Node. js is sometimes misunderstood by developers as a backend framework that is exclusively used to construct servers. This is not the case; Node. js can be used on the frontend as well as the backend.

What is front end search?

A front-end implementation hits our servers directly, without going through your back end. It can be up to 10x faster for the end user to retrieve results. DSN. We provide a distributed API, allowing you to select multiple data centers around the world.

Should filtering be done on frontend or backend?

So if you have a a large amount of data, it is better to implement the filtering logic on the backend and let the database handle all the heavy lifting for us. Contrary to this, if you are dealing with less amount of data, you can do the filtering logic on the frontend.

Is Nodejs a good choice for backend?

If you are looking for real-time web apps, then Node. js might be the best choice for Back-end development as it has all the above features which is very great in delivering excellent performance. It is built on a single-threaded, non-blocking event loop, Google V8 engine and low-level API.


1 Answers

If you search in the frontend then you have to load the entire dataset into the frontend and keep it synchronised for every query. This is not a good idea.

Use database queries - that is what they are designed for, and you only need to transfer the results.

like image 198
OrangeDog Avatar answered Oct 25 '22 03:10

OrangeDog