Questions about Custom App Capabilities & Functionality

4 0 0


I have been trying to wrap my head around working with Shopify custom apps but am left with some questions for which I'm unable to find answers online. 

I have been using boilerplate code that was generated via `$ shopify node create` and my questions will therefore also be based around that setup.

Any info is much appreciated.


Are there any files that Shopify looks for and loads automatically if they are present?


The boilerplate uses `koa`, `koa-router`, and `next`. What's the recommended approach for defining an API, via NextJS or via Koa Router?


Could someone kindly provide a code example for a Koa route setup and explain how to check the route's response?


Can one create an API route within NextJS's `pages/api` folder and have the route be private/authenticated? Could someone kindly provide a code example?


Since the app is self-hosted, can API routes be made publicly available? If so, how?


How will an expired session token affect my API? Will my webhooks still work if I never visit the app page within the Shopify shop admin area?


Am I assuming correctly that, if a Shopify webhook attempts to reach a route within my app, will it then go through the authentication process as that is a middleware and as such is a prerequisite to the route?


Is an app that's only intended to handle API calls and webhooks better placed within a private app? I posted a separate question reg. this, to explain what I'm looking to accomplish in more detail here:


Thanks for your help in advance.