Deploying Node JS website

I am trying to deploy a node js site on cloudflare, but my node modules folder is defaulted to contain many files, and I receive an error saying I cannot upload more than 1000 files. How do I work around this?
9 Replies
AlphaCentauri
AlphaCentauri13mo ago
You shouldn't upload the node_modules folder at all - the dependencies for your project will be redownloaded as part of the build step when Cloudflare Pages is deploying your project.
spaone
spaoneOP13mo ago
I did that, but I still receive this error when i try to deploy: No webpage was found for the web address:
AlphaCentauri
AlphaCentauri13mo ago
Does your *.pages.dev domain work? Or is this error only occuring with your custom domain (if you've added one)? Sometimes it can take a few hours for custom domains to start working as the DNS propagates. Also you said it was a NodeJS app? Cloudflare Pages only supports static content so if you have a webserver like Express, it won't work.
spaone
spaoneOP13mo ago
I am using express. What do you suggest I should do?
AlphaCentauri
AlphaCentauri13mo ago
?pages-webserver
Flare
Flare13mo ago
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 (https://developers.cloudflare.com/pages/platform/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.
AlphaCentauri
AlphaCentauri13mo ago
If you don't want to rewrite a lot of code and want to continue using Express, the best course of action is likely to just get a VPS and then use Cloudflare solely as a CDN
spaone
spaoneOP13mo ago
Thank you I appreciate it Would I be able to rewrite it using react and it would work?
AlphaCentauri
AlphaCentauri13mo ago
Yes, a React app will work fine with Cloudflare Pages
Want results from more Discord servers?
Add your server