Shopify / shopify-app-template-node

MIT License
889 stars 400 forks source link

send HTTP request from external app to this app #1337

Closed tuanda-mh closed 2 months ago

tuanda-mh commented 2 months ago

Hi, when I created this issue earlier, you guys told me to add my route before the line: app.use("/api/*", shopify.validateAuthenticatedSession()); and it will work. But when I did that and sent the request via Postman, it still returned this:

<!DOCTYPE html>

tuanda-mh commented 2 months ago

please help

tuanda-mh commented 2 months ago

I used the following url to send my request: app-url/route

paulomarg commented 2 months ago

Sorry, I misunderstood your last question!

I think the problem might be that in development, your request will hit the frontend vite server first, so you'll need to add a proxy for the route you're using.

Probably something like this in your vite.config file:

    proxy: {
      "^/(\\?.*)?$": proxyOptions,
      "^/api(/|(\\?.*)?$)": proxyOptions,
+      "^/route(/|(\\?.*)?$)": proxyOptions,
    },

Hope this helps!

tuanda-mh commented 2 months ago

this solved my issue, thank you very much

paulomarg commented 2 months ago

Happy to hear that, sorry for the confusion :)

Closing the issue then!