skip to Main Content

So I am currently learning react and webpack so that I can implement it into my current site. I already have an established phpmyadmin database that pumps out information that I want to appear on my site but I cant figure out how to hide my username and password to the database when programming it. I am used to using php to interact with my database bus since react is purely javascript I am not sure what to do.

2

Answers


  1. You need to have a server running that talks to your database and to your react app. It sounds like you might have this in the form of a PHP application. Your PHP application will need to expose data over HTTP endpoints that you can then fetch from inside of your React application.

    This tutorial: https://www.techiediaries.com/php-react-rest-api-crud-tutorial/ would be a great place for you to get started.

    Login or Signup to reply.
  2. I agree that you need to “have a server running that talks to your database and to your react app” as the accepted answer states. On the other hand this does not mean that you have to code it from scratch.

    If you don’t want to program PHP for the back-end, then you may as well configure software from the list of ‘automatic APIs’. An automatic API is “software that turns your database into a REST/GraphQL API”.

    I’m the author of PHP-CRUD-API, which is an ‘automatic API’ and I think it suits your needs, but you may as well use any other software from the above list.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search