How to implement Workers in my already existing Vite + React project?

HI there. I have a static site already been made in Cloudflare Pages. But I need to implement Workers within the site / project. I have looked around and there doesnt seem to be a solution. If you need to look how my project is structured, I can provide a link to my Github repo. Thank you in advance.
6 Replies
Hello, I’m Allie!
What are you trying to do? Serve API requests? Transform a pre-existing page?
GAMUUz
GAMUUzOP10mo ago
To serve api requests yes. Or does this all have to be done through Functions? For an example. fetching the worker and do job that way?
Hello, I’m Allie!
A Function is a stripped-down Worker, so a lot of tasks that you can do on Workers should be doable in Functions
GAMUUz
GAMUUzOP10mo ago
Might be a stupid question: Importing my code into said Function will work then?
Hello, I’m Allie!
It should, as long as you follow the correct format
GAMUUz
GAMUUzOP10mo ago
Ok, thank you for the replies. I'll give it a go. ❤️
Want results from more Discord servers?
Add your server