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

Where in the docs does it explain how to build the front-end for a local RealApp backend? #74

Open
dnk8n opened this issue Apr 11, 2019 · 12 comments

Comments

@dnk8n
Copy link

dnk8n commented Apr 11, 2019

I may be missing something obvious, but I would expect this in the README.txt of the repo.

@SidneyNemzer
Copy link

It looks like the API URL is hardcoded here:

Url.Builder.crossOrigin "https://conduit.productionready.io"

@dnk8n
Copy link
Author

dnk8n commented Apr 12, 2019

I found that and changed it. I then rebuilt the elm app, however for a reason I cannot understand it still points to the productionready.io target.

I attempted to clear the app data, etc.

No success.

@SidneyNemzer
Copy link

It will be hard to help without seeing your code. Do you have it on Github maybe?

@dnk8n
Copy link
Author

dnk8n commented Apr 12, 2019 via email

@dnk8n
Copy link
Author

dnk8n commented Apr 12, 2019 via email

@dnk8n
Copy link
Author

dnk8n commented Apr 30, 2019

It will be hard to help without seeing your code. Do you have it on Github maybe?

Here is the only code change I have made: dnk8n@ac8d039

Can anyone shed some light here?

@dnk8n
Copy link
Author

dnk8n commented Apr 30, 2019

Some further information.

To start the web-server I do: elm-live -p 8080 src/Main.elm

and get the following output:

Success! Compiled 1 module.                                          

elm-live:
  The build has succeeded. Starting the server!


Reload web server:
  - Website URL: http://localhost:8080
  - Listening on port: 8080
  - Monitoring dir: /home/.../.../elm-spa-example

elm-live:
  Watching src/**/*.elm.

But then I get the following display on the http://localhost:8080

console_elm
network_elm

@dnk8n
Copy link
Author

dnk8n commented Apr 30, 2019

I guess I should state that I am running the RealWorld API from http://localhost:8000. It is the Django backend found at: https://github.com/gothinkster/django-realworld-example-app

I have made no modifications there at all. The API is available (as can be see in the image above, 200 success codes)

@dnk8n
Copy link
Author

dnk8n commented Apr 30, 2019

Note: I also tried: elm make src/Main.elm --output elm.js and http-server

The output is as follows:

Dependencies loaded from local cache.
Dependencies ready!                
Success! Compiled 33 modules.

and

Starting up http-server, serving ./
Available on:
  http://127.0.0.1:8080
  http://192.168.43.178:8080
Hit CTRL-C to stop the server
[Tue Apr 30 2019 09:59:46 GMT+0200 (South Africa Standard Time)] "GET /" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36"
[Tue Apr 30 2019 09:59:47 GMT+0200 (South Africa Standard Time)] "GET /assets/images/loading.svg" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36"
[Tue Apr 30 2019 10:00:17 GMT+0200 (South Africa Standard Time)] "GET /" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36"

The website looks similar, although I think another problem has crept in here, because last week your master branch displayed correctly and now it is not. Seems it is not able to find the JS and/or the CSS?

@billewanick
Copy link

@dnk8n Try updating your whitelist in the Django backend, that might help
https://github.com/gothinkster/django-realworld-example-app/blob/master/conduit/settings.py#L132

@nicktheo59
Copy link

Try https://conduit.productionready.io/api if you’re just wanting to kick the tyres.

Interestingly it seems the database/backend for this Elm front-end is shared with the other ‘official’ Real World / Conduit demo .. makes sense since the Elm one is just hosted with (static) Netlify

@senorsmile
Copy link

I had the same issue but realized that chrome was aggressively caching content.
I went to firefox and saw it going to the correct back end.

Ctrl+f5 forced it to reload.

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

No branches or pull requests

5 participants