Help with Shopify App Routing: Auth Callback , Root Endpoint

Hi everyone,

I’m working on a standalone Shopify app using the Node.js template, and I’ve run into a routing issue.

What I Want to Achieve:1. During the first installation of the app:

  • The Shopify app should hit the api/auth/callback endpoint to handle authentication.
  1. After the app is installed:
    • When the user clicks the app from their Shopify admin, it should hit the root endpoint (app.get(“/”)) instead of going through api/auth/callback again.

Current Problem:- If I define the root endpoint (app.get(“/”)), it gets called after installation, and the api/auth/callback endpoint is skipped entirely during installation.

  • I need api/auth/callback to be called during the first installation and app.get(“/”) to be accessed after the installation when the app is launched.

I enchanted the same issue. i use a conditional routing to do it . But hopes someone could provide a better stategy.

Hi,
could you please clarify what you did, for example, did you provide a if condition.