惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Stack Overflow Blog
Stack Overflow Blog
Y
Y Combinator Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
M
MIT News - Artificial intelligence
GbyAI
GbyAI
A
About on SuperTechFans
T
The Blog of Author Tim Ferriss
雷峰网
雷峰网
Blog — PlanetScale
Blog — PlanetScale
J
Java Code Geeks
IT之家
IT之家
Microsoft Azure Blog
Microsoft Azure Blog
V
V2EX
爱范儿
爱范儿
N
Netflix TechBlog - Medium
U
Unit 42
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
博客园 - 叶小钗
G
Google Developers Blog
Jina AI
Jina AI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The GitHub Blog
The GitHub Blog
腾讯CDC

Deno

Deno 2.8 | Deno Claw Patrol: an open-source security firewall for agents | Deno Fresh 2.3: Zero JS by default, View Transitions, and Temporal support | Deno Deno 2.7: Temporal API, Windows ARM, and npm overrides | Deno Build a dinosaur runner game with Deno, pt. 6 | Deno Build a dinosaur runner game with Deno, pt. 5 | Deno Deno Deploy is Generally Available | Deno Introducing Deno Sandbox | Deno Build a dinosaur runner game with Deno, pt. 4 | Deno Build a dinosaur runner game with Deno, pt. 3 | Deno Build a dinosaur runner game with Deno, pt. 2 | Deno React / Next.js Denial-of-Service Vulnerability: Deno Deploy users protected | Deno Deno 2.6: dx is the new npx | Deno Build a dinosaur runner game with Deno, pt. 1 | Deno React Server Functions / Next.js Vulnerability: Deno Deploy users protected | Deno My highlights from the new Deno Deploy | Deno Deno's Other Open Source Projects | Deno How Deno protects against npm exploits | Deno Help Us Raise $200k to Free JavaScript from Oracle | Deno Deno 2.5: Permissions in the config file | Deno Fresh 2.0 Graduates to Beta, Adds Vite Support | Deno Deno 2.4: deno bundle is back | Deno JavaScript™ Trademark Update | Deno What's coming to JavaScript | Deno A brief history of JavaScript | Deno Reports of Deno's Demise Have Been Greatly Exaggerated | Deno An Update on Fresh | Deno How Plaid migrated 100 services to a new database platform 5x faster with Deno | Deno Deno 2.3: Improved deno compile, local npm packages, and more | Deno Add JSR packages with pnpm and Yarn | Deno
Connecting to Postgres from the edge | Deno
Luca Casonat · 2021-11-12 · via Deno

Postgres is one of the most popular databases. It is fast, familiar, and featureful. It is the first choice of database for many companies. One drawback of Postgres: applications can only connect to it via TCP - a protocol that is not supported by many serverless at edge runtimes (e.g. Cloudflare Workers, Vercel Edge Functions, or Netlify Edge Handlers).

This is often a problem with serverless at edge products. They don’t have the same capabilities as an application running inside of a VM, or a container on Kubernetes. This makes them a non-starter for many that need to integrate into an existing system.

With Deno Deploy, we are building a more serverless at edge system with more capabilities. Developers should be able to build locally as they normally do: connect to Postgres, read static files from disk, and use environment variables for configuration. Then be able to deploy globally to our 28 regions across the world without additional boilerplate, configuration, or concerns about missing capabilities.

So with that: how do we connect to Postgres from edge? Well, you import your driver, connect to the database as usual, and then run queries… There is really nothing special to it.

On Deno Deploy you can connect to your Postgres databases (even with TLS and custom CA certificates) from the edge. You can also connect to other databases with non-HTTP protocols like Redis, MySQL, or MongoDB. To take full advantage of the global nature of Deno Deploy, you could use the Postgres interface to connect to a globally distributed Cockroach DB database. Or to a global Google Spanner instance using its new Postgres interface.

Heck, you could even connect to more obscure systems like MQTT, or even manage your Minecraft game server using Minecraft RCON.

If you want a more detailed rundown of using Postgres on Deno Deploy, check out our Postgres tutorial in the Deno Deploy documentation. You can also check out the Deno documentation on Deno.connect, Deno.connectTls, and Deno.startTls - the APIs used create outbound TCP and TLS connections from Deno and Deno Deploy.