DEV Community

Cover image for Heard about DENO?
Anders Persson
Anders Persson

Posted on β€’ Edited on

Heard about DENO?

Disclaimer; I'am a backend developer, and try to keep up with frontend, so this (my first) article can be basic for many frontend developers.

Deno has the same creator as NODEJS (Ryal Dahl), Deno was a project started because Ryal had many things he learned working with Nodejs, and like to change, but it was easier to start over.

Focus in Deno is Security, and it is ALL CLOSED BY DEFAULT, so a script has to get ok, for write, read .. , and latest version access can be set on domain level.

Another big thing is DENO doesn't have a package handler, like node, you don't download stuff, you access them the same way as you do in webpages. But.. to make transit from Node easy today Deno understands NPM, so you can slowly rewrite if you like.

But, the big thing for me is deno runs TypeScript out-of-the-box, without setting up anything, just have an .ts extension and you can do a

deno run myscript.ts

of course

deno run myscript.js

for javascript works to.

Example myscript.js

console.log("Hello World");
Enter fullscreen mode Exit fullscreen mode

Example myscript.ts

function addHello(data: string) {
    return `Hello ${data}`;
}
console.log(addHello("World"));
Enter fullscreen mode Exit fullscreen mode

But there is another nice thing, you can write scripts for terminal, and make a standalone binary, which runs without deno, but don't forget to allow access rights, like if your script likes to read a folder, else it will not be allowed to do this.

deno compile myscript.ts

Om my windows machine it gives me a myscript.exe
This is just a scratch what Deno can do, read more at deno homepage
Link: deno.land

Happy hacking!
Anders

πŸ‘‹ While you are here

Reinvent your career. Join DEV.

It takes one minute and is worth it for your career.

Get started

Top comments (0)

11 Tips That Make You a Better Typescript Programmer

typescript

1 Think in {Set}

Type is an everyday concept to programmers, but it’s surprisingly difficult to define it succinctly. I find it helpful to use Set as a conceptual model instead.

#2 Understand declared type and narrowed type

One extremely powerful typescript feature is automatic type narrowing based on control flow. This means a variable has two types associated with it at any specific point of code location: a declaration type and a narrowed type.

#3 Use discriminated union instead of optional fields

...

Read the whole post now!

πŸ‘‹ Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay