Skip to content

Commit 04c0771

Browse files
Adds content to interoperability_with_nodejs video page (#1453)
Co-authored-by: Jo Franchetti <[email protected]>
1 parent 7ffb365 commit 04c0771

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

examples/videos/interoperability_with_nodejs.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,45 @@ url: /examples/interoperability_with_nodejs/
44
videoUrl: https://www.youtube.com/watch?v=mgX1ymfqPSQ&list=PLvvLnBDNuTEov9EBIp3MMfHlBxaKGRWTe&index=2
55
layout: video.tsx
66
---
7+
8+
## Description of video
9+
10+
Deno gained lots of interpoperability capabilities at its v2.0 release. In this
11+
video, we'll look at how to use Node.js built-in APIs, NPM modules, and JSR
12+
packages.
13+
14+
## Transcript and examples
15+
16+
[Deno 2.0](https://deno.com/blog/v2) is here, and it's good. One of the most
17+
amazing features of Deno is its interoperability with other platforms including
18+
Node. For example, we can use the core Node.js built in APIs. All we have to do
19+
is add this Node specifier here.
20+
21+
```ts
22+
import { fs } from "node:fs/priomses";
23+
```
24+
25+
Deno also supports the use of NPM modules. All you need to do is add the NPM
26+
specifier with your import and you're good to go.
27+
28+
```ts
29+
import { * } as Sentry from "npm:@sentry/node";
30+
```
31+
32+
We can also take advantage of [JSR](https://jsr.io), an open source package
33+
registry for TypeScript and JavaScript.
34+
35+
```ts
36+
import OpenAI from "jsr:@openai/openai";
37+
```
38+
39+
JSR works with Deno, of course, but also with Node.js. bun, and CloudFlare
40+
workers. You can even install JSR packages into Vite and Next.js applications.
41+
42+
Deno also gives us
43+
[import maps](https://docs.deno.com/runtime/fundamentals/modules/#differentiating-between-imports-or-importmap-in-deno.json-and---import-map-option),
44+
which help us manage our dependencies. You can install a package from JSR. The
45+
import will be added to the `deno.json`, and you can even use a shorthand to
46+
describe this to clean up your code even more. Deno 2.0 is focused on a really
47+
solid developer experience. New projects and migrations feel a whole lot easier
48+
with Deno.

0 commit comments

Comments
 (0)