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");
Example myscript.ts
function addHello(data: string) {
return `Hello ${data}`;
}
console.log(addHello("World"));
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
Top comments (0)