FROM CACHE - en_header

Adding an API and using NextJS pages with Shopify App CLI boilerplate app [node]

8 0 1

I've been exploring the approach suggested by the CLI but something I've failing to achieve is to add my own API endpoints to interact with a Mongo database.

I understand the boilerplate uses NextJS, but also that it puts a Koa server in front, changing how Next behaves. .

I can use my API endpoints from outside the app, as a normal NextJS app would, but when I try to use those endpoints from `getStaticProps` on a NextJS page, those requests appear to be intercepted for auth validation, and failing to do so. 

How does one go about this in this environment. Do we have to include some middleware so it doesn't fail validation, or does the solution provided by Shopify nullifies NextJS abilities when it comes to APIs altogether?

Somewhat related, it also appears that we should avoid using NextJS page to page navigation methods, as that triggers the authentication process each time, is this accurate?

Replies 0 (0)