David Chouinard
David Chouinard

Reputation: 6856

Connecting to SQL database from Vercel/Next serverless functions?

What's the best practice for connecting to an SQL database from Vercel/Next.js serverless functions? I've seen a few options commonly mentioned:

Trying to understand what the "best practice" solution to this problem is — have others deployed solutions they're satisfied with?

Upvotes: 3

Views: 1785

Answers (1)

Edgar
Edgar

Reputation: 59

For personnel blog application should be okay to connect your edge function direct to database. Unless, this small website becomes super popular.

Eventually, For your application hosted on edge, another API endpoint is needed. It can be REST API or GraphQL does not matter. What matters is that, at the front this endpoint will accept loads of request from your edge functions (nodejs applications on vercel/netlify) and at the back, it will communicate with database, pool the connections and caching so on. You can add nginx load balancer in front of that API endpoint to make it scale. There are tons of options to engineer it

Upvotes: 0

Related Questions