Node.js built-ins on Deno Deploy
We’re excited to announce that beginning right this moment, Deno Deploy helps importing
Node.js built-in modules corresponding to http
, fs
, and path
. Now you can run
present Node.js apps on the edge.
Deno Deploy is a
next-generation cloud platform
constructed on JavaScript isolates. It runs your JavaScript, TypeScript, and
WebAssembly on the edge,
in our 35 global regions, near your
customers. It scales routinely, from zero to 1000’s of requests per second.
Deno Deploy comes in-built with tremendous speedy deployments from GitHub, and
a global database.
Beginning right this moment, you should use Node.js built-in modules in your Deno Deploy
functions. Modules corresponding to fs
, path
, crypto
, or http
now work out
of the field, enabling you to run present Node.js apps on the edge, with out
trouble.
import { createServer } from "node:http";
import course of from "node:course of";
const server = createServer((req, res) => {
const message = `Hey from ${course of.env.DENO_REGION} at ${new Date()}`;
res.finish(message);
});
server.pay attention(8080);
See this instance dwell: https://dash.deno.com/playground/node-specifiers
This implies that you may now run Express functions
on Deno Deploy:
import categorical from "https://esm.sh/categorical?goal=denonext";
const app = categorical();
app.get("https://deno.com/", (req, res) => {
res.ship("Hey from Deno Deploy!");
});
app.pay attention(8080);
See this instance dwell: https://dash.deno.com/playground/express-demo
Importing of all 47 Node.js built-in modules is supported. Nonetheless, as all
functions working on Deno Deploy are sandboxed, some modules corresponding to
child_process
don’t present any helpful performance. For a full checklist of
supported modules and limitations, seek advice from the documentation:
https://deno.com/deploy/docs/runtime-node
Whereas the Node.js built-in modules behave identically to their native Node.js
counterparts, there are circumstances the place our implemenation isn’t but excellent. In the event you
encounter any points,
please file an issue.
That is simply the standard starting of our Node.js compatibility story in Deno
Deploy. Within the above categorical instance, esm.sh is used to load the npm module
categorical. We’re working to carry
npm specifiers help natively
to Deno Deploy. Keep tuned for updates on this quickly.