Skip to content

Running your first Deno app

In this post, we will how to run a Deno app from console. After installing Deno you are ready to run your first program!

Syntax

deno run <path to file>

Write the following lines on a file and save it as firstDeno.ts

console.log("Hey hey! This is my first Deno app");

Let’s run firstDeno.ts and see what’s the output.

> deno run firstDeno.ts
Compile file:///home/anand/Documents/firstDeno.ts
Hey hey! This is my first Deno app

It works!

There are some pretty good examples in Deno’s library and you can run them using deno run command.

deno run https://deno.land/std/examples/flags.ts

There you go! You have just run your first Deno code.

Download https://deno.land/std/examples/flags.ts
Warning Implicitly using master branch https://deno.land/std/examples/flags.ts
Download https://deno.land/std/flags/mod.ts
Warning Implicitly using master branch https://deno.land/std/flags/mod.ts
Download https://deno.land/std/testing/asserts.ts
Warning Implicitly using master branch https://deno.land/std/testing/asserts.ts
Download https://deno.land/std/testing/diff.ts
Warning Implicitly using master branch https://deno.land/std/testing/diff.ts
Compile https://deno.land/std/examples/flags.ts
{ _: [] }

See also  How to install Deno in Ubuntu?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.