I am working on a project the backend is in python Django and frontend in react-js and database is MySQL. Now the problem is I need to search products from database in my project but don’t know how to get query for frontend to backend. I don’t know the code Moreover I am using rest-framework and Axios library to connect. I am very thankful to you if you help me to create search related queries in my project. Thank you
CodePudding user response:
You should elaborate more. What is the issue? means "do you have issue about how to implement search at DB?" or 'how to send data from frontend to backend and vice-versa'
CodePudding user response:
Your question is kind of vague, but I will try to put my thoughts on it as best as I can.
What I would do is create APIs with query parameters in the backend, and implement the API in the frontend.
For instance, my API could be http://myproduct.com/api/product?search=smartphone. On the frontend side, you can use the form data and send it to the backend using query params.
If you are not familiar with how to pull from API in React.js, I would recommend going through the React documentation here.
My answer is based on the fact that I know very little about what actually you are trying to accomplish. If you can be more detailed, I can explain and elaborate better.
