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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nx-plugin): TRPC using base url depending on the provider #574

Closed
wants to merge 4 commits into from

Conversation

cskiwi
Copy link
Contributor

@cskiwi cskiwi commented Jul 26, 2023

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Which package are you modifying?

  • vite-plugin-angular
  • vite-plugin-nitro
  • astro-angular
  • create-analog
  • router
  • platform
  • content
  • nx-plugin
  • trpc

What is the current behavior?

In the current implementation, the app defaults to running trpc on http://127.0.0.1:4200/. To enhance flexibility and accommodate different hosting providers, this pull request introduces a getBaseUrl function. With this update, the trpc endpoint can be easily adjusted based on the hosting environment. Changing the port or any other configurations will now be automatically resolved, providing a more adaptable and seamless experience.

This change aims to improve the app's configurability and ensure smoother deployments across various hosting setups. Your review and feedback on this pull request would be highly appreciated. Thank you!

Closes #

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

[optional] What gif best describes this PR or how it makes you feel?

@netlify
Copy link

netlify bot commented Jul 26, 2023

Deploy Preview for analog-docs ready!

Name Link
🔨 Latest commit ee88236
🔍 Latest deploy log https://app.netlify.com/sites/analog-docs/deploys/64d9d81a3c560e0008716ef5
😎 Deploy Preview https://deploy-preview-574--analog-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify
Copy link

netlify bot commented Jul 26, 2023

Deploy Preview for analog-app ready!

Name Link
🔨 Latest commit ee88236
🔍 Latest deploy log https://app.netlify.com/sites/analog-app/deploys/64d9d81af1b8210008b22e64
😎 Deploy Preview https://deploy-preview-574--analog-app.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify
Copy link

netlify bot commented Jul 26, 2023

Deploy Preview for analog-blog ready!

Name Link
🔨 Latest commit ee88236
🔍 Latest deploy log https://app.netlify.com/sites/analog-blog/deploys/64d9d81ac143ae0008177405
😎 Deploy Preview https://deploy-preview-574--analog-blog.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@cskiwi cskiwi changed the title feat: using base url depending on the provider feat(nx-plugin): using base url depending on the provider Jul 26, 2023
@cskiwi cskiwi changed the title feat(nx-plugin): using base url depending on the provider feat(nx-plugin): TRPC using base url depending on the provider Jul 26, 2023
@goetzrobin
Copy link
Member

I really like this!
In an ideal world the user does not have to worry about setting an absolute path at all and can simply put "/api/trpc", "trpc", etc.

Maybe this should be exposed as a function of the trpc package instead of the Nx plugin template?
@brandonroberts @cskiwi what do you guys think?

@cskiwi
Copy link
Contributor Author

cskiwi commented Jul 29, 2023

I really like this! In an ideal world the user does not have to worry about setting an absolute path at all and can simply put "/api/trpc", "trpc", etc.

Maybe this should be exposed as a function of the trpc package instead of the Nx plugin template? @brandonroberts @cskiwi what do you guys think?

@goetzrobin That sounds like a good idea. However, before implementing it into the 'trpc' package, we should take a look at resolving the following issue: #468.

This precautionary step is necessary to ensure that we don't introduce any breaking changes, especially if addressing the issue requires making additional changes to the way the API is passed along. By doing this, we can assist the users while still retaining the flexibility to make changes to the 'trpc' package in the future.

@goetzrobin
Copy link
Member

Hey there @cskiwi! Check out this PR: #639
There might still be some gotchas I am missing, but it seems like it would make a getBaseUrl unnecessary and the TrpcClient would "just" work!

@cskiwi
Copy link
Contributor Author

cskiwi commented Sep 12, 2023

Hey there @cskiwi! Check out this PR: #639 There might still be some gotchas I am missing, but it seems like it would make a getBaseUrl unnecessary and the TrpcClient would "just" work!

Oh nice! this would be beautifull for the developer experience!

@cskiwi cskiwi closed this Sep 12, 2023
@cskiwi cskiwi reopened this Sep 12, 2023
@brandonroberts
Copy link
Member

Closing as resolved via #639 which will go out with the next release

@cskiwi cskiwi deleted the feat/baseurl_from_env branch September 15, 2023 12:13
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.

3 participants