DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Alberto Beiz
Alberto Beiz

Posted on

Exploring Denoland #1 - My first stomps with DENO

Sooo Deno 1.0 just launched. I have 0 knowledge about it but I’m curious to see what it has to offer.

As the seasoned software developer that I am, let’s start as usual:

Alt Text

Deno.land looks promising, let’s execute the installation command:

curl -fsSL https://deno.land/x/install/install.sh | sh
Deno was installed successfully

That was fast and easy. After adding needed variables to my .bash_profile I can see my deno version:

$ deno --version
deno 1.0.0
v8 8.4.300
typescript 3.9.2

Soooooo let’s try it...wait...I...can...execute...remote...scripts...just...like...this:

$ deno run https://deno.land/std/examples/welcome.ts
Welcome to Deno πŸ¦•

That’s useful...and scary...but they say it’s secure so Β―_(ツ)_/Β―

Ok last test in deno.land is the classic web server. I create a new test.ts file, copy the code:

import { serve } from "https://deno.land/std@0.50.0/http/server.ts";
const s = serve({ port: 8000 });
console.log("http://localhost:8000/");
for await (const req of s) {
 req.respond({ body: "Hello World\n" });
}

and run $ deno test.ts

ERROR...It’s $ deno run test.ts

ERROR Uncaught PermissionDenied: network access to "0.0.0.0:8000", 
run again with the --allow-net flag

Here is the security, I have to explicitly allow Deno access to network requests:

$ deno run test.ts --allow-net 

ERROR...what about...

$ deno run --allow-net test.ts 

SUCCESS --- Hello Denoland

End of exploration #1

  • Native Typescript support πŸ’™πŸ’™πŸ’™πŸ’™
  • I like the idea of a strong and controlled standard library.
  • No package.json, fixed urls for packages. What about updating?

Have you tried Deno? Any thoughts about it?

@albertobeiz

Top comments (1)

Collapse
javaarchive profile image
Raymond

Maybe sometime all of the cdns will host a copy of deno because if deno.land goes down the first time someone runs a script that would be a problem.

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.