Node.js > Deploy & Run cmd from package.json

I just deployed a node js app in cloudflare pages but the issue is: HOW SHOULD I RUN THAT CMD WHICH IS IN THE PACKAGE.JSON FILE ??? cuz without that, it wont work for example: I need to run node server.js after deploy HOW CAN I DO THAT ??? HELP PLS PLS PLS
2 Replies
SuperHelpflare
SuperHelpflare•4w 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. 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.
👑Eliot Spencer💜
My app needs express to create a server and also needs socket io cuz it's a simple chat app without any databases Just to send and receive messages without saving any data to anywhere Can Functions do that? Can I deploy this on cloudflare for free?

Did you find this page helpful?