DEV Community

Discussion on: Announcing the DigitalOcean App Platform Hackathon on DEV!

Collapse
 
anupa profile image
Anup Aglawe

I have a doubt regarding how routes are setup for a static sites and it's corresponding web service.
My specific use case is to implement GitHub oauth on my react/express/GraphQL application.

Locally everything works fine, I have a button which redirects my react app to localhost:4000/auth/GitHub , which gets redirected to GitHub oauth page and then successful login redirects back localhost:3000 (react app).

But on my app platform, I can see only a single APP_URL. I'm confused which goes where and GitHub oauth requires app url & callback url ( localhost:3000 & localhost:4000/user/signin/callback ) this works well in my local env. But not sure what should I put when in production.

Collapse
 
ayanb profile image
Ayan Banerjee

It appears you need two separate apps for the frontend and backend. In that scenario, simply create 2 apps in the app platform.

Thread Thread
 
anupa profile image
Anup Aglawe

But the straight forward way seems to be just adding a static site component and web service component, and most probably they were meant to be used in that manner. (and not creating separate apps for client and server ).

Also, if I add a http route let's say /api on my web service component. I can access GraphQL endpoints by ${APP_URL}/api/graphql

Thread Thread
 
ayanb profile image
Ayan Banerjee

Yes, thanks. That seems to be a much cleaner way!