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

推荐订阅源

腾讯CDC
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Proofpoint News Feed
D
DataBreaches.Net
D
Docker
云风的 BLOG
云风的 BLOG
大猫的无限游戏
大猫的无限游戏
月光博客
月光博客
J
Java Code Geeks
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
罗磊的独立博客
Martin Fowler
Martin Fowler
U
Unit 42
Engineering at Meta
Engineering at Meta
IT之家
IT之家
Vercel News
Vercel News
B
Blog RSS Feed
人人都是产品经理
人人都是产品经理
博客园 - Franky
博客园 - 【当耐特】
Stack Overflow Blog
Stack Overflow Blog
G
Google Developers Blog
MongoDB | Blog
MongoDB | Blog

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
Node.js built-ins on Deno Deploy | Deno
Luca Casonat · 2023-05-26 · via Deno

We’re excited to announce that starting today, Deno Deploy supports importing Node.js built-in modules such as http, fs, and path. You can now run existing Node.js apps at the edge.

A screenshot of a Deno Deploy playground using the `node:http` built-in module

Deno Deploy is a next-generation cloud platform built on JavaScript isolates. It runs your JavaScript, TypeScript, and WebAssembly at the edge, in our 35 global regions, close to your users. It scales automatically, from zero to thousands of requests per second. Deno Deploy comes built in with super speedy deployments from GitHub, and a global database.

Starting today, you can use Node.js built-in modules in your Deno Deploy applications. Modules such as fs, path, crypto, or http now work out of the box, enabling you to run existing Node.js apps at the edge, without hassle.

import { createServer } from "node:http";
import process from "node:process";

const server = createServer((req, res) => {
  const message = `Hello from ${process.env.DENO_REGION} at ${new Date()}`;
  res.end(message);
});

server.listen(8080);

See this example live: https://dash.deno.com/playground/node-specifiers

This means that you can now run Express applications on Deno Deploy:

import express from "https://esm.sh/express?target=denonext";
const app = express();
app.get("/", (req, res) => {
  res.send("Hello from Deno Deploy!");
});
app.listen(8080);

See this example live: https://dash.deno.com/playground/express-demo

Importing of all 47 Node.js built-in modules is supported. However, as all applications running on Deno Deploy are sandboxed, some modules such as child_process do not provide any useful functionality. For a full list of supported modules and limitations, refer to the documentation: https://deno.com/deploy/docs/runtime-node

While the Node.js built-in modules behave identically to their native Node.js counterparts, there are cases where our implemenation is not yet perfect. If you encounter any issues, please file an issue.

This is just the humble beginning of our Node.js compatibility story in Deno Deploy. In the above express example, esm.sh is used to load the npm module express. We are working to bring npm specifiers support natively to Deno Deploy. Stay tuned for updates on this soon.