I need to map a specific endpoint on my shopify virtual store. There’s a QRcode on a physical card that redirects to my shopify store with an id as a parameter (i.e. www.my-store.com/card/ABDK-GTR). The thing is that each card has its own id, so I need to map the endpoint /card/{id} and use this id to redirect to another site (i.e. www.another-website.com/path/ABDK-GTR). Is there a way I can do that?
I’ve tried implementing a shopify app with a controller in node.js
import express from "express";
const app = express();
...
app.get('/card/:id', (req, res) =>{
const cardId = req.params.id;
const redirectUrl = 'https://www.another-website.com/path/' + cardId;
res.redirect(redirectUrl);
})
...
but got no success with it. When I run my app everything goes just fine, if I try to access in a local server via ngrok and pass a ID, it does what it should do (https://d584-201-73-178-100.ngrok-free.app/card/ABC-DEF redirects to https://www.another-website.com/path/ABC-DEF). But then I installed this app on the virtual store to map the endpoint in the store (www.my-store.com/card/{id}) and it just doesn’t work.
Am I missing something? Is there another way of doing this? Any help would be appreciated!