Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Use REACT_APP_BACKEND_URL for all requests #76

Closed
ruupert opened this issue Mar 23, 2018 · 2 comments
Closed

Feature request: Use REACT_APP_BACKEND_URL for all requests #76

ruupert opened this issue Mar 23, 2018 · 2 comments
Labels
enhancement New feature or request

Comments

@ruupert
Copy link
Contributor

ruupert commented Mar 23, 2018

Problem:

Current development environment works only if the front end is run on localhost along with the backend. In the current production test server there's another path for the backend.

In a local development environment scenario where the back and front end is not run on localhost from the browsers point of view, one has to go in and change the request urls in the labtool2.0/src/Login.js to something which is the actual host where the back end is. In the current docker-compose.yml file there is already an environment variable called REACT_APP_BACKEND_URL specified and documentated here: https://github.com/labtool/labtool/wiki/Deployment

Solution proposal:

Change the behaviour of these

    if (process.env.NODE_ENV === 'development') {
      backend = 'http://localhost:3001/api/users/update'
    } else {
      backend = '/labtool-backend/users/update'
    }

to

backend = process.env.REACT_APP_BACKEND_URL + '/api/users/update'

or something similar (some check somewhere to see if the REACT_APP_BACKEND_URL is set, and if not then set it to default like http://localhost:3001) so that anyone can just specify where the backend is without having to change the front end code in any way.

@ruupert ruupert added the enhancement New feature or request label Mar 23, 2018
@NorthernLion
Copy link
Contributor

This has been fixed in branch Redux. For local development, you need to add REACT_APP_BACKEND_URL to .env file. Hopefully, it will be merged into dev by the end of the day.

@NorthernLion
Copy link
Contributor

Fixed in 4_02 part of dev now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants