I have questions about the CLI ?
I've been using the Shopify cli and I haven't seen the "routes" where I can do the requests, be they Post , Get , put etc. I've spent a lot of time analyzing the code and I can't create a get or a post, is there a tutorial that can help me with this
@ClairCc I stopped using the shopify-cli generated app. Just published a working example using nextjs. If you know nextjs you can do whatever you want. https://github.com/redochka/nextjs-shopify-app-no-custom-server Give it a try
You can't use next api routes. We tried something like this:
Component.js
const Component = () => (
const app = useAppBridge();
const authFetch = authenticatedFetch(app);
useEffect(() => {
const fetchData = async () => {
const response = await authFetch('/api/your-route')
const data = await response.json();
}
fetchData()
}, [])
...
...
server.js
router.get(
'/api/your-route',
verifyRequest({ returnHeader: true }),
async (ctx) => {
ctx.res.statusCode = 200;
// do things
},
);
This issue is stale because it has been open for 90 days with no activity. It will be closed if no further action occurs in 14 days.
We are closing this issue because it has been inactive for a few months. This probably means that it is not reproducible or it has been fixed in a newer version. If it’s an enhancement and hasn’t been taken on since it was submitted, then it seems other issues have taken priority.
If you still encounter this issue with the latest stable version, please reopen using the issue template. You can also contribute directly by submitting a pull request– see the CONTRIBUTING.md file for guidelines
Thank you!