Backend with mysql database and frontend in javascript (react-native)

0

I'm developing an application in javascript (for android) and I would like to use mysql as the database for this application, but I was not able to use mysql in the same code so I did some searches that indicated separating by backend and frontend only that I do not know about. If someone has a link explaining (can be in English / Spanish), or explain to me how to do this backend (preference in java) and how to include this code in js would be grateful!

    
asked by anonymous 07.02.2018 / 11:31

1 answer

1

Pedro, I believe your case is a little lower. I do not know what you want to develop, what kind of service you want, but ideally you would separate the layers by following this concept:

  • React / Javascript for Front End
  • REST service to deliver the data
  • Do not embed data in Application / Do not use local database

Local database is good only for quick query services, type, Book, where you have all the chapters written there.

The REST service I suggest, it does not really matter what language you do, Java, PHP, .NET, whatever, the important thing is for this layer to talk to the Database, MySQL or PostgreSQL or whatever the data for your application, regardless of whether it is Android / iOS or even a website, because you serve all your applications regardless of the platform.

A simple article to create an API: link

Example Usage:

  • In React you create a registration form
  • Send via AJAX to URL link
  • The service adds the register and returns ok, or false, it depends on ..
  • Your React application responds to a successful registration and redirects to the user list screen
  • In turn this user list screen requests another ajax to link
  • Here it returns a JSON with all registered users
  • Your React application Lists the users of your REST application
  • And so it goes .....

I hope you have understood the concept and understand that there is not one solution to your case but several. Abs

    
07.02.2018 / 11:57