Quickview
Note: This article is translated from: https://dev.to/gregfletcher/what-is-deno-js-and-why-should-you-care-b26 . Some common terms I will keep. You can go to the original link for reference.
- Deno.js released version 1.0.0 on May 13, 2020.
- Deno was created by Ryan Dahl, who also created Node.js.
- Deno is protected by default. Without authorization, it cannot access files, networks or environments.
- Deno built-in TypeScript without any additional configuration.
- Many external packages are imported by url (like Go).
- Deno is the name that is reversed from Node and read as Deeno (long e).
Start
In 2018 Ryan Dahl gave a speech at JSConf EU (Javascript conference in Europe) about 10 frustrations for his own Node.js.
In his speech, Ryan mentioned that interest in the node_module system and other legacy APIs will never change. He noticed that JavaScript has changed a lot since Node.js was born and that he has found a way to make a better version of Node.js. He wants it compatible with the browser AND server environment. Security is also what Ryan places.
May 13 -> Launch date
A lot has happened since Ryan’s talk at JSCONF 2018. Many people have participated in the project, and it has gained 48k stars on Github, and the project is gradually gaining much attention in the community before. when it came out officially.
Only time will tell if Deno will continue to grow, but the initial reaction, according to the writer, is very optimistic.
Top Syntax Features
Top Level Await
No longer wrap around async functions. Only use advanced syntax await.
1 2 | const data = await fetch('someapi/data'); |
Import and URLs
You can use import and you don’t need to NPM install all your packages. Much like GoLang, you can import from URLs.
You can use import and you don’t need NPM to install all the packages. Looks like GoLang, you can import from URL.
1 2 | import stuff from 'https://package/url' |
TypeScript Built In
No need to install TypeScript. All have been built-in. You just need to write the code only!
Default security
Deno limits access to files, networks and environments. This is a big difference with Node.js, where Node.js allows instant access to everything.
ES6 and more
Unlike Node, Deno has the opportunity to combine with modern JavaScript syntax because it can remove callback hell like Node causes.
Compatible with Web
Deno’s API is of course compatible with the Web
Web Assembly
Deno support for wasm binaries. (You can read about the wasm binaries here: https://blog.vietnamlab.vn/2018/08/08/gioi-thieu-webassembly-tuong-lai-cua-web/ ).
Summary
Deno is an interesting project that you should try!
I want to clarify that this article is not about to bring down Node.js. Node.js is great, I love it and will continue to use Node.js. Is it just better to have a new and improved version out there in the future?