Can Pages and Workers be in same project

Hello:

I am new to using Cloudflare. I wish to create a JAM stack project using static HTML web site (Nuxt based) and APIs for dynamic data.

I have been able to create my Nuxt site and set up Pages.

Is there a way to place the API code using workers as a subdirectory of my project?

Thanks,

You can try using the open beta of Pages Functions, which run on Workers: https://developers.cloudflare.com/pages/platform/functions/

As well as the normal functions routing (Preferable for an API), there’s also an “Advanced mode” which will let you write your own custom Worker code in front of the Pages project as _worker.js: https://developers.cloudflare.com/pages/platform/functions/#advanced-mode

2 Likes

Thanks @Erisa for your prompt response. Let me check the above links

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.