#Mariadb with cloudflare worker

9 messages · Page 1 of 1 (latest)

harsh abyss
#

Hey I want to upload my nodejs website to cloudflare pages and use my own mariadb database that I have only my server since I must have it to work fast because its a game server that must talk with the db without latency.
Can I connect my database to cloudflare pages using cf workers?

thick seal
nimble scarab
#

I wouldn't recommend that, that's long unmaintained, and starting a new connection to the db for each function run is really inefficient. You'd want to pool the connections or use some http/rest interface between you and the database. Cloudflare does support outbound TCP Connections now, but I don't know of any libraries that have been updated to use it.

nodejs website to cloudflare pages
Cloudflare Pages supports Pages Functions, which run in a similar environment as Workers, as V8 Isolates, not node.js. You only have node.js in the build environment. If your site uses a web framework like Express it won't work on Pages

thick seal
#

if he already has a server running I dont see why he shouldnt use cloudflared. For me it worked really well.
But yeah otherwise he'll have to wait for mysql or mysql2 support when workers tcp socket api has been implemented for those libs.

harsh abyss
#

How to use cloudflared with cloudflare pages for connecting my db to the website

nimble scarab
harsh abyss
#

The only problem is the database connection

harsh abyss