Razkif
Razkif
CDCloudflare Developers
Created by Razkif on 8/8/2024 in #pages-help
Pages + Functions or Pages + Worker (How to dev full-stack locally)
I'm trying to create a "simple" form with form submission. Ideally what I'd like to do is create my form locally, projects/mysite.com/index.html. Then ,create all the form handling and CSRF token, turnstile logic under projects/mysite.com/src/index.ts. Then, configure the .toml file to route the worker under api.mysite.com/contact But I'd also like to do everything locally before pushing to GitHub & deploy to CF. Initially I was running a http-server for /website and wrangler dev for the worker. With a node server proxy in the middle. But I'm following some tutorials that are talking about running functions within a functions directory under a static page setup and then pushing to CF and letting CF dictate the handling of routes. I'm just not sure if this is something I can do and run locally? I'm also not sure if what I'm doing would be considered best practice, there's not a whole of documentation on running the full-stack development locally.
8 replies