Deno Runtime Quick Start
Deno
(/ˈdiːnoʊ/, pronounced
dee-no
) is an
open source JavaScript,
TypeScript, and WebAssembly runtime with secure defaults and a great developer
experience. It's built on V8,
Rust, and Tokio.
Let's create and run your first Deno program in under five minutes.
Install Deno
Install the Deno runtime on your system using one of the terminal commands below.
- macOS
- Windows
- Linux
curl -fsSL https://deno.land/install.sh | sh
irm https://deno.land/install.ps1 | iex
curl -fsSL https://deno.land/install.sh | sh
Additional installation options can be found here.
After installation, you should have the deno
executable available on your
system path.
Create a simple web server
Create a TypeScript file called server.ts
and include the following code:
Deno.serve((_request: Request) => {
return new Response("Hello, world!");
});
The Deno runtime has built-in APIs for server-side
functionality like HTTP servers, in addition to APIs
found in the browser like the Request
and
Response
objects from the
fetch
API.
Start your server using the deno
command:
deno run --allow-net server.ts
The Deno runtime is secure by default, so the
--allow-net
flag is required to give your code network access to start an HTTP
server. Visit localhost:8000 to see your local server
running.
🚀 Host your server on Deno Deploy (optional)
The Deno runtime is open source and runs on just about any cloud. You can also run Deno programs on Deno Deploy. Here's how it works.
Install the deployctl
command line utility:
deno install -Arf https://deno.land/x/deploy/deployctl.ts
Deploy your server with deployctl
. If this is your first time using Deno
Deploy, you'll be prompted to sign in with a GitHub account:
deployctl deploy --include=./server.ts --entrypoint=./server.ts
In a few moments, your server should be available on a public URL, deployed across 30+ datacenters worldwide.
Next steps
We've only just scratched the surface of what's possible with the Deno runtime. Here are a few topics you might want to explore next.