0

I have a react / redux app that have a lot of ajax calls to an endpoint.

The endpoint url is written to a config.json file;

{endpoint: 'apiEndpoint.url'}

How should I get this URL from that file and where should I store it?

I have a lot of actions that uses fetch to get the data.

the endpoint url is written to the config file during release, so I can't access it before. It has to be on "runtime".

williamwmy
  • 321
  • 1
  • 4
  • 19
  • 1
    Do you use webpack to build your app? If so, does your config.json file is being written before or after running webpack build script? – Slava.K Jan 27 '17 at 11:21
  • I do use webpack, but the config.json file is written after webpack build. The config.json is written in a post-deployment step. – williamwmy Jan 27 '17 at 13:38
  • See this, it worked for me: http://stackoverflow.com/questions/36065832/webpack-include-configuration-file-as-external-resource – Giladd Jan 27 '17 at 15:11

0 Answers0