Implement Search, Sort, Filter and Pagination Rest API With Node JS | Express | MongoDB
Вставка
- Опубліковано 19 чер 2022
- What's up Guys,
Today we gonna be building this awesome project with MERN stack. By building this project you gonna learn how to create API which handle pagination, sort, filter and search. Yes, all of this in one API. And we also gonna learn how to call this API and show the data in beautiful UI from frontend with React.
Why do we need to build API's like this. Because By adding search, filter with pagination makes it easier for the user to find what he is looking. I'm so excited to build this project for you guys, I hope you too. Before we jump into our vscode those who new to this channel I highly recommend you to subscribe and like this video. So without wasting time Let's Get Started....
Source Code : github.com/cyber-wolve/IMDB_C...
╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
Music In Video :
Rhodesia by Twin Musicom is licensed under a Creative Commons Attribution 4.0 license.
creativecommons.org/licenses/...
Artist: www.twinmusicom.org/ - Наука та технологія
Watch this video to Implement Search, Sort, Filter and Pagination in React JS
=> ua-cam.com/video/_i4Wi43NTDo/v-deo.html
subscribed brother. Feeling proud that you are an Indian brother. You are doing a great job ,the same would have been explained by other youtubers like for more than 2 hours. Dont stop ,keep doing more and more MERN stack projects in same fashion .God bless you!!
other youtubers will take 3 hour to teach the same thing,thanks for being concise
exactly!!
Oh yes!🎉
But they will explain each and everything, and why are we using any option that's why so that you do need to watch any video again
Hey there, this was very informational. Thank you for taking your time in preparing this!
what a quick implementation ... great dear thanks for this logic.
thank you sir for quality content waiting for the next video.
Bro, been looking for a system like this one, thanks bro
This is really amazing video man.
Keep posting such videos.
BTW I loved the way you explain each step u worked on.
Thanks, helped me a lot
nicely done, i finally understand how to make a search for my api 😊. ty a lot sir
Nice one
amazing video editing. You can make a video editing course as well. Nice code!
Beautiful
Thank you so much sir...
Good tutorial!
Спасибо Вам большое за Вашу работу!
nice one
what tool did you use to create your mock-ups
Make a video on implementing Roles in api
Bro please upload the next part of this video which is related to frontend api handling
👍
This video need mores view
@CyberWolves please upload frontend part🙏
bro... we are waiting next video.. please upload it.. thanks lot bro
Will upload soon
@@CyberW0lves upload soon
This video is pure gold but lacks one most important thing called "explanation"...so basically just a github code made to video...i would rather look at code if this is the explanation
The postman part was very confusing, please give a quick explanation of how to set up these API's or databases next time.
Create more nodejs projects🙏
what if we want to use search for Number datatype?
Your theme bro? And font?
Hi friend, I need a help. How can I give two options to the sort method? for example in this video we have sort by genres so can we add another options such as lemme say we have films and they have genres and costs and we have to sort it not only in genres but also in costs for example : movie "Interstellar"
cost:"12"
genre:"Sci-fic"
and user can sort only in cost or only in genre or with both of them
Can you help me? thanks in advance man:)
I'm facing with the same problem, I've tried few things to add a second tcheckbox with other choices but I'm stucked. Anyway thanks a lot to Cyberwolf for this perfect tutorial !
@@fxpin9293 dude if you found how to add two different categories feel free to share your knowledge bud :)
WHat if I want rating along with gender filter?
I can't get my total to go below eight, even when I filter. I have eight documents in the database
EDIT: Okay I did it.
const total = await Project.find({name: {$regex: search, $options: "i"}}).where("genre").in([...genre]).countDocuments({
language: { $in: [...genre] },
name: { $regex: search, $options: "i" },
});
I had to add the filters (without the skip and limit) to the total.
Please upload the next video
Sorry for the delay will upload soon.
Hey guys, try out this node js typescript boilerplate
github.com/chiragmehta900/node-typescript-boilerplate-postgres
Please stare at this repository if you like this.
How to implement in react ?
To implement in React. You create a useState (example, backendData)
In a useEffect fetch the api and format the api like this: `/api/movies?page=${page}&name=${name}&genre=${genre}`
still within the useEffect, set the backendData to that link
The curly brackets are useStates that you can input later.
Hi i get this error when i try to make the search with postman
const castError = new CastError();
^
CastError: Cast to ObjectId failed for value "movies" (type string) at path "_id" for model "Recipe"
at model.Query.exec (C:\Users\Gabi\OneDrive\Desktop\food cloud\server
ode_modules\mongoose\lib\query.js:4786:21)
at model.Query.Query.then (C:\Users\Gabi\OneDrive\Desktop\food cloud\server
ode_modules\mongoose\lib\query.js:4885:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
messageFormat: undefined,
stringValue: '"movies"',
kind: 'ObjectId',
value: 'movies',
why i get this ? ty
It looks like a problem within the Schema. Do you have a link to the project?
kab ayegi next video
bro can you merge this with mongodb database
case insensitive sorting?
bro use "let sort = req.query.sort || "rating"; " so how can it sort by year ? How can I get the year and the rating at the same time, sir?
bhai hindi me bhi banao na
Frontend code??
Will be uploaded in next Week.
@@CyberW0lves thanks a lot
@@CyberW0lves when will it be uploaded sir
@@AshishKumar-sn6ky Will be uploaded tomorrow.
Which theme you are using