I am currently writing a pet project for an online store in React. I’m using a db.json file, which stores all the data I need (store products, categories, etc.) I ran into a problem when I need to query the database with some specific attributes, for example, get products with specific ids = 1,2,3 or immediately get an array of products sorted by price.
Previously, I used mockapi and there it was possible to add attributes such as sortBy, order to the request. For my project, mockapi don’t give that much free space. Therefore, I am forced to use a simple db.json file.
My question is what do I need to do to be able to make more detailed queries. I’ve heard a bit about mysql, php and so on, but I don’t know what I need to do specifically. Please guide me on what to do.
What do I need to add to my project for more specific requests
2
Answers
You should go for the mongodb which will be more relevant and easy to use for the projects related to the react because it is easy to use with the mongodb through react and it is easy to use and you can get the cheatsheet for the queries also in the web.
You can use json server for fake rest Api’s for development purposes.