halfzebra/create-elm-app

CORS option for elm-app start

UlisseMini opened this issue · 2 comments

Hi! I like to develop my backend separate for the frontend, In my current setup I have

localhost:8000 as my API endpoint
localhost:3000 as my elm server (from elm-app start)

The issue is I cannot make HTTP requests to localhost:8000 because of CORS, It might be desirable to either

  1. Enable CORS for localhost by default
  2. Add a --cors option to elm-app start

For now I'm just going to use an extension to disable CORS, but it might be nicer for elm-app to handle it.

EDIT:

Maybe an even better idea, add an option to write live-rebuilds to the filesystem, so for example my backend could be serving files in ./build and every time I change my elm they update.

Feel free to close this if I'm missing something, I'm a noob so I won't be offended :)

I may also be missing something, but I think CORS needs to be handled by the server.

I think the only way to have elm-app handle that, would be to start a cors proxy server pointing at the backend.

Regarding the edit, you should be able to use entr to do something like that.

Sorry for keeping this open, I forgot. I'm using an extension to disable CORS when I'm developing (and I'm already using entr)