Hey everyone, I am a new self-taught developer and have some questions regarding apps. I apologize in advance if the question is too obvious or simple.
I am currently trying to build an app for a local supermarket as a way to get experience in the development world. The app needs to pull data from a MySQL database that the owner has through GoDaddy. It also needs to have an admin panel.
Problem: I have the app ready, and it works using Firebase. I also have the admin panel built with React and Redux. However, I have no idea how to integrate the app with the Admin Panel. Can somebody please mentor me in this case?
Thanks.
There isn't really enough detail in your question to give you concrete answers. React/Redux are frontend technologies, and it sounds like you have your data in a MySQL database somewhere. There is no mention of any kind of backend, so I assume you don't have one. In that case, I don't know enough about GoDaddy to know what APIs it exposes for modifying your database, but unless you want to let literally anyone with the URL to your admin panel to be able to modify your data, you're going to need to include some authentication. Now, the classic way to do this is to look into creating some sort of backend to authenticate admins (with some kind of login system. There are many ways to do this, Laravel and Ruby on Rails are fairly time-tested technologies for doing this), and also serve as an in-between from your frontend admin panel to your database. The cost of doing it this way is you're going to have to have a server to host somewhere which will add to the maintenance cost for your client. Alternatively, there are ways which don't involve creating a backend, such as OAuth authentication. This article talks about a few: https://css-tricks.com/apis-and-authentication-on-the-jamstack/. Firebase can also do authentication for you, though it sounds like it only offers an SDK, not hosting (you will still need to create a authentication server, or use OAuth or other third-party authentication tech if you use Firebase).
I'd say keep it simple and create a small express.js back end on heroku https://devcenter.heroku.com/articles/getting-started-with-nodejs
This would communicate with the database. You would setup routes that your react app could access using something like axios
express: app.get('/products', (req, res) => { // call mysql db run query and return result // set up db connection... dbconn.query('select * from products'). then(result => { res.send(result.rows) }).catch(e => res.sendStatus(400)) }) react: axios.get('https://app.herokuapps.com/products').then(resp => console.log(resp.data))