ExpediaGroup / cyclotron

A web platform for constructing dashboards.
https://www.cyclotron.io/
MIT License
1.56k stars 112 forks source link

API requests don't work #38

Open iyakhiev opened 5 years ago

iyakhiev commented 5 years ago

API requests don't work for me.

GET /dashboard starts working after the fix in routes/api.js app.get('/api/dashboards', dashboards.get);

I've added '/api' on the start. It seems to me others will start working after the same fix.

I've used the quickstart guide, but apparently something went wrong.

baumandm commented 5 years ago

Hi @iyakhiev, this sounds like some kind of configuration mismatch. By default, cyclotron-svc listens for /dashboards etc without an /api prefix and this shouldn't need to change.

The cyclotron-site config configService.js should have a line like this:

restServiceUrl: 'http://localhost:8077',

You don't need to add /api there unless you're handling it via a proxy or something.

If you setup Nginx or another server to reverse proxy /api/* URLs to cyclotron-svc, you will need to strip off the prefix with a rewrite rule. There's an example in the nginx.conf file in the repo:

location ~* ^/api/(.*)$ {
    rewrite ^/api/(.*)$ /$1 break;
    proxy_pass http://localhost:8077;

If I misunderstood what the issue is, please let me know. Or, if there's some documentation that's out of date or misleading, let me know and I'll make sure it gets updated.

iyakhiev commented 5 years ago

Hello, @baumandm.

Request doesn't work even from Cyclotron API page. I'am using nodejs server and there are no any proxies and things like this. I installed it to try on my home PC using installation instructions.

image

baumandm commented 5 years ago

@iyakhiev, there's no /api/ path in the URL. Does it work if you try http://localhost:8077/dashboards?