Goal: Turn Cloudflare Pages project into a full stack application by adding Cloudflare Workers.
With Pages, you can now build full-stack applications by executing code on the Cloudflare network with help from Cloudflare Workers
Issue: A Cloudflare Worker is not automatically created after adding a functions folder.
To get started, create a
/functions
directory at the root of your project. Writing your Functions files in this directory will automatically generate a Worker with custom functionality at the predesignated routes.
Steps taken
1.) Create a Github repo with an index.html file, css and js folders
2.) Connect the Github repo to a new Cloudflare Pages project.
3.) Add folder in Github called “functions” at the root
4.) Commit the change
Result: No additional files are created in the functions folder.
Using a
/functions
directory will generate a routing table based on the files present in the directory.