0

I need to load async from same server running my React, but this doesn't work ( if I set path from remote it works), error is Invalid URI :

request.get('statefulsetv.yaml', function (error, response, body) {
            console.log(error);
            if (!error && response.statusCode == 200) {
                var data = yaml.load(body);
                // console.log(data);
                containers = data.spec.template.spec.containers;
                self.setState({ containers_state: containers });



                // Continue with your processing here.
            }
        });
AVEbrahimi
  • 17,993
  • 23
  • 107
  • 210
  • If you want to read a file, you should do it using `fs`. There's an answer here https://stackoverflow.com/questions/10058814/get-data-from-fs-readfile – Julio Betta Sep 02 '17 at 17:39
  • what is your `request` object ? – Panther Sep 02 '17 at 19:33
  • I suppose every file you want to read needs to have the full URL. You need to prepend your `statefulsetv.yaml` with `http://localhost:port`, e.g. `http://localhost:3000/statefulsetv.yaml` – Patrik Prevuznak Sep 02 '17 at 23:14

0 Answers0