A secure runtime for JavaScript and TypeScript. — by (Deno.land)[https://deno.land/]
Since you are reading this blog, I would assume that you may have probably worked using Node.JS or maybe coming from Javascript development background.
Before (Node.JS)[https://nodejs.org/en/], Javascript world was somewhat unorganized, the only bigger movement we had were jQuery and Backbone (though there are some other smaller movement worth mentioning like Prototype.JS, etc)
Node.JS was a big thing that happened to Javascript community, it pushed it toward an organized community like other programming languages. But before Node.JS, most of developer had programming language as their core development work. We rarely used to find a developer who used to work in Javascript full-time.
Node.JS changed that scenario, people started taking Javascript seriously and that improved Javascript significantly and we have seen Javascript ecosystem evolved with Webpack, ReactJS, Angular, Vue.JS in front-end and Express.JS in the backend. But since then it had a lot of hiccups. We all can recall callback hell, node_modules being heavy and npm modules with unnecessary dependencies and code. This made backend development as a nightmare and that’s why nowadays you mostly see Node mostly being used as ecosystem manager rather than a complete server-side JS ecosystem as imagined initially.
To overcome these hurdles Ryan Dahl came with reimagining server-side JS with (Deno)[https://deno.land/]. Here are few things that may catch your attention and help you differentiate Deno from NodeJS
- Deno ships only in a single executable file, making it compact and without unnecessary overhead
- It is secure by default, sandboxes your code as it should be. Files, Network and environment access needs to be enabled explicitly
- Supports TypeScript out of the box, meaning that you can execute
.ts
files without first transpiling them to Javascript - No NPM or it’s equivalent, no node_module overheads, modules as single JS file can be referenced as URL or file paths
- No
package.json
and defaultindex.js
file for modules - All async operations on Deno return a promise
- Deno always dies on uncaught errors
- Uses ES Module to import no
require
- Remote files are always cached on the first execution and are not updated unless run with
--reload
flag, nonpm install
- Browser compatible by default, no more
globals
:), you can usewindow
instead
So far so good, going by specs it does look promising and we are moving back to old Javascript simplicity, security while catching with the world of technologies.
Installation
Deno ships as a single executable with no dependencies. You can install it using your favorite installers, or download it from the releases page.
Shell (Mac, Linux):
curl -fsSL https://deno.land/x/install/install.sh | sh
PowerShell (Windows):
iwr https://deno.land/x/install/install.ps1 -useb | iex
Homebrew (Mac):
brew install deno
Chocolatey (Windows):
choco install deno
Scoop (Windows):
scoop install deno
Build and install from source using Cargo
cargo install deno
First Program
Once you have installed Deno, please run post-install instructions if any, or you are good to go. Source your bashrc or bash_profile or restart your terminal. Run the following command
deno run https://deno.land/std/examples/welcome.ts
you should see something like this
Download https://deno.land/std/examples/welcome.ts
Warning Implicitly using master branch https://deno.land/std/examples/welcome.ts
Compile https://deno.land/std/examples/welcome.ts
Welcome to Deno 🦕
You are good to go now. Keep watching this space for more updates. Thanks for reading
About The Author
I am Pankaj Baagwan, a System Design Architect. A Computer Scientist by heart, process enthusiast, and open source author/contributor/writer. Advocates Karma. Love working with cutting edge, fascinating, open source technologies.
To consult Pankaj Bagwan on System Design, Cyber Security and Application Development, SEO and SMO, please reach out at me[at]bagwanpankaj[dot]com
For promotion/advertisement of your services and products on this blog, please reach out at me[at]bagwanpankaj[dot]com
Stay tuned <3. Signing off for RAAM