Utilizing outside APIs from internal server #113
Unanswered
bayou-brogrammer
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Hi @lecoqjacob! Do you mean that the client would not make this weather service request, but instead it would be done entirely on the backend server? If that's the case, we would put this code in the server target only, and the server would make this request in whatever middleware needs it. The server's environment is defined here: https://github.com/pointfreeco/isowords/blob/209e1d78f4b28f69e218017fa934ede4f0200cd2/Sources/SiteMiddleware/ServerEnvironment.swift In it you can see that we have several external services that the server communicates with (iTunes Connect, Mailgun, SNS) that the client need not know about 😄 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
While looking at ways to follow the structure of isowords into my own play app, I am curious about how one might handle making outside API calls (say a weather API), from the server router written in isowords. My main influence of this decision is being able to hide API keys in the server-side of the app away from the client app.
At a quick glance following the code, I would assume you would need a way to just use the APIClient, but be able to pass a baseUrl. From there you could construct an API call and use the baseUrl of the weather service to make it.
Beta Was this translation helpful? Give feedback.
All reactions