Can i know how to create an Express App using cloudflare workers
Iam new to workers as i can see the workers are pro honon kind of thing
I would love to explore hono also but for now can i know if there is any blog or video sources to know how to build an backend uding express and cloudflare workers
11 Replies
Express isn't really for Workers, it's for a server. This is a serverless world where things run on invocation rather than all the time
Hono is a good alternative
Ok is there any service from Cloudfare from which I can build backends and deploy them
No
can i even deploy a backend on cloudfare
Depends what you mean by a backend. If you are asking to run something that is always listening on a port then no. But if you are looking to run serverless as your backend then yes
Hi @Md.Sadiq
To learn more about workers, maybe check out https://workers.cloudflare.com/playground or try running
npm create cloudflare
to scaffold a new project on your machine.I have an existing backend written in express without using Wrangler how I can add Wrangler to it and deploy serverless on cloudflare
afaik express uses node apis like http and https which are not available in the workers platform, so you can't deploy those express apps directly using wrangler, even with the latest nodejs_compat_v2 flag. see
- https://blog.cloudflare.com/more-npm-packages-on-cloudflare-workers-combining-polyfills-and-native-code/
- https://developers.cloudflare.com/workers/runtime-apis/nodejs/
The Cloudflare Blog
More NPM packages on Cloudflare Workers: Combining polyfills and na...
Workers now supports more NPM packages and Node.js APIs using an overhauled hybrid compatibility layer.
Cloudflare Docs
Node.js compatibility | Cloudflare Workers docs
Node.js APIs available in Cloudflare Workers
you would have to migrate your express app to something like hono which is able to target the workers platform.
Thank you
Replace Express with Hono or Elysia