1

I have a web application hosted on Heroku that uses PostgreSQL. I want to make a React Native application that can access that database.

How can I do that?

0

1 Answer 1

1

A typical architecture would be to add an API to your web application and have your React Native application talk to the API. I'm not sure how much obfuscation is provided by React Native, but generally speaking client-side code shouldn't contain sensitive information like database credentials.

I wouldn't recommend having multiple applications talk directly to the database, regardless of technology.

Having said that, Heroku does have some guidelines about how to access your database from outside of Heroku. Briefly,

  • don't hard-code your database credentials since they could change at any time
  • instead, use heroku config:get DATABASE_URL to retrieve the credentials from your Heroku application

This is commonly used with graphical database clients, for example.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.