Fireship · @fireship
Deno in 100 Seconds
Uploaded May 5, 2020 · Length 2:10
Summary
deno explained in 100 seconds: a new way to write server-side JavaScript with rust and typescript
- deno
- server-side javascript
- rust
- typescript
- javascript engine
- async programming
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
denim a brand new way to write
- 0:02
server-side JavaScript it solves many of
- 0:04
the same problems as nodejs and was even
- 0:06
created by the same guy like node it
- 0:08
uses the v8 JavaScript engine under the
- 0:10
hood but the rest of the runtime is
- 0:12
implemented in rust and typescript our
- 0:14
journey into denna land begins in a
- 0:16
single type script file in this file we
- 0:17
have access to all the types in the
- 0:19
runtime which means we can write
- 0:20
strongly typed code and get
- 0:22
documentation and intellisense directly
- 0:24
in the IDE without ever needing to touch
- 0:26
a TS config file the features in the
- 0:28
runtime can be accessed from this demo
- 0:30
namespace let's console.log the current
- 0:32
working directory of the filesystem we
- 0:34
can execute our script with demo run
- 0:36
from the command line but you'll notice
- 0:37
the throws an error and that's because
- 0:38
demo is secure by default you the
- 0:41
developer need to give permission to
- 0:42
perform different actions in the runtime
- 0:44
in this case we can use the allow read
- 0:46
flag to allow this operation security is
- 0:49
great but my favorite thing is how
- 0:50
everything asynchronous is promise based
- 0:52
we can make a network request using the
- 0:54
fetch API just like we would in the
- 0:56
browser and because it supports
- 0:57
top-level wait we don't even need an
- 0:59
async function here we can start
- 1:00
resolving promises without any extra
- 1:02
boilerplate code denno attempts to make
- 1:04
your code as browser compatible as
- 1:06
possible it contains a window object
- 1:08
with lifecycle events that you can
- 1:09
listen to allowing developers to more
- 1:11
easily write code that can interrupt
- 1:12
between browsers and servers not to
- 1:14
mention it can also execute web assembly
- 1:16
binaries but one thing that won't work
- 1:18
in demo are your NPM packages instead
- 1:21
you import packages using the modern yes
- 1:23
module syntax with remote modules being
- 1:25
referenced by their URL when you run
- 1:27
your script for the first time it will
- 1:28
download this code locally and cache it
- 1:30
there's no package JSON and code can be
- 1:32
referenced from any URL very similar to
- 1:34
how things work in the browser demo
- 1:36
provides a set of standard modules to
- 1:37
solve common use cases for example we
- 1:40
can import serve from the HTTP module we
- 1:42
can use it to create a server that's
- 1:44
treated as an async iterable we can then
- 1:46
await every request from the server and
- 1:48
respond to it accordingly and that's an
- 1:49
awesome starting point for a server-side
- 1:51
JavaScript app now then au 1.0 just hit
- 1:54
release candidate 1 so if you start
- 1:55
using it today
- 1:56
consider yourself an early adopter do
- 1:58
you think denno is the future of
- 1:59
server-side JavaScript let me know in


