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

推荐订阅源

美团技术团队
T
The Blog of Author Tim Ferriss
C
Check Point Blog
博客园_首页
J
Java Code Geeks
云风的 BLOG
云风的 BLOG
L
LangChain Blog
小众软件
小众软件
Stack Overflow Blog
Stack Overflow Blog
爱范儿
爱范儿
Vercel News
Vercel News
博客园 - Franky
V
V2EX
IT之家
IT之家
U
Unit 42
N
Netflix TechBlog - Medium
腾讯CDC
Apple Machine Learning Research
Apple Machine Learning Research
Microsoft Azure Blog
Microsoft Azure Blog
罗磊的独立博客
博客园 - 叶小钗
H
Help Net Security
V
Visual Studio Blog
GbyAI
GbyAI

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.