Now Reading
Node.js built-ins on Deno Deploy

Node.js built-ins on Deno Deploy

2023-05-26 09:14:22

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.

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

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

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()}`;
}); attention(8080);

See this instance dwell:

This implies that you may now run Express functions
on Deno Deploy:

import categorical from "";
const app = categorical();
app.get("", (req, res) => {
  res.ship("Hey from Deno Deploy!");
}); attention(8080);

See this instance dwell:

See Also

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:

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, 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.

Source Link

What's Your Reaction?
In Love
Not Sure
View Comments (0)

Leave a Reply

Your email address will not be published.

2022 Blinking Robots.
WordPress by Doejo

Scroll To Top