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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make API path namespace configurable #53

Merged

Conversation

dtslvr
Copy link
Contributor

@dtslvr dtslvr commented Mar 16, 2019

Now it's possible to customize your route like

  • http://localhost:8080/cubejs-api/v1/load?query=... (default)
  • http://localhost:8080/my-custom-route/v1/load?query=...

I'm still not fully satisfied with the versioning. In my opinion the endpoint should be like this http://localhost:8080/my-custom-route/v1/cubejs/load?query=... where cubejs should also be customizable.

But this format is not possible at the moment 馃 How could we solve this?

@paveltiunov
Copy link
Member

@dtslvr Hey Thomas! Seems good to me. The only thing: basePath would be probably more usual name for the option.

Regarding versioning: I believe Cube.js API should be versioned separately from other APIs as it will be usually upgraded just by Cube.js version upgrade.

@dtslvr
Copy link
Contributor Author

dtslvr commented Mar 17, 2019

Thanks for the feedback, @paveltiunov. What do you think about adding the version to the default base path?

this.basePath = options.basePath || '/cubejs-api/v1';

Then the consumer is completely free to override the version if needed.

I will change baseRoute to basePath.

@paveltiunov
Copy link
Member

@dtslvr It's a great question. Actually original idea was to optionally have several endpoints for different API versions at the same time. My guess is API versions in this case should be controlled by server core code. What do you think?

@dtslvr
Copy link
Contributor Author

dtslvr commented Mar 18, 2019

Yes, I agree. I have refactored baseRoute to basePath now.

Adapting the url schema from http://localhost:8080/cubejs-api/v1/load?query=... to http://localhost:8080/api/v1/cubejs/load?query=... would cause breaking changes because the frontend client also needs adaption. Let's keep it for the moment.

@dtslvr dtslvr marked this pull request as ready for review March 18, 2019 07:23
@paveltiunov paveltiunov merged commit b074a3d into cube-js:master Mar 18, 2019
@paveltiunov
Copy link
Member

@dtslvr Hey Thomas! Looks great! Thanks for contributing this!

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

Successfully merging this pull request may close these issues.

None yet

2 participants