express node js on cloudflare pages and worker
how can i use express cloudflare pages and worker
6 Replies
?pages-webserver
Cloudflare Pages is for static content (HTML, CSS, JS, images and other such files). It will not run a webserver such as Express, Koa or the likes. If you're using those to serve static content then you can just remove that part and use Pages!
If you're doing more dynamic content you can use Functions. It will run code on request (so still not a webserver in the conventional sense). This would allow for more dynamic content though especially with KV (Key/Value storage) and Durable Objects (transactional data storage). Functions are natively integrated with Pages so are super easy to get up and running along your website.
Otherwise, a good old VPS or dedicated server from one of the many hosts out there is for you.
TLDR: you can’t use express. You would need to refactor
buddy can show. Any example.s of refactor
We cannot give you an example of how to refactor your code, as we do not know how your current code is structured and "that example" of refactoring does not exist.
Depending on the extend of your current project, the following article may help to give you a brief overview of how Cloudflare Workers work:
https://medium.com/codex/my-first-cloudflare-worker-5cdb453725fe
Small hint: in the wrangler.toml the author uses wrong quotation marks. There the regular
" "
must be used.Medium
My First Cloudflare Worker
In the tech world, there’s a bunch of innovators that are creating the next innovation. One of those companies is Cloudflare, the CDN…
wait for this https://blog.cloudflare.com/container-platform-preview/
The Cloudflare Blog
Our container platform is in production. It has GPUs. Here’s an ear...
We’ve been working on something new — a platform for running containers across Cloudflare’s network. We already use it in production, for AI inference and more. Today we want to share an early look at how it’s built, why we built it, and how we use it ourselves.