Getting started with Deno.






The new Javascript and Typescript runtime from Ryan Dahl, Node's creator, has been released in the event you missed it! It has some pretty cool features, and is ready for use by the public! Let's look at some of the nice features, and start with a simple hello Nawab!


What is Deno, then?


Deno is a new runtime written mostly in Rust, for Typescript (and Javascript). It has some fantastic goals and some very interesting "Non-Objectives," including not using npm and not getting a.json set.

If you're familiar with Node.js, the common JavaScript server-side ecosystem, then Deno is just like Node. Besides that in other respects changed significantly.


Let's start with a short list of features I like about Deno the most:


  • It is based on the latest features of the language JavaScript

  • It possesses a broad standard library

  • It has TypeScript at its heart, offering a huge advantage in several different ways including first-class TypeScript support (you don't have to compile TypeScript separately, it's done automatically by Deno)

  • It encompasses modules ES

  • It does not have a Product Manager

  • It has a first-class expectation

  • It features an integrated test facility

  • It aims to be as browser-compatible as possible, by providing for example a built-in fetch and the global window object


let me take you through the features of Deno!!


Node.js will look like something old after you've used Deno and learned to appreciate its features.

Especially because the Node.js API is callback-based, as promises and async / await have been written long before. There is no change available in Node for that, since such a change would be monumental. And we're stuck with callbacks or promisive calls to an API.

Node.js is amazing, and will remain the de facto standard in the world of JavaScript. But I think we'll see Deno gradually getting more and more adopted because of its first-class TypeScript support and modern standard library.

Deno can afford to use new technology to get anything written, because there is no backward compatibility to maintain. Of course, there's no guarantee that the same will happen to Deno in a decade and a new technology will emerge, but that's the truth right now.


Why Deno, then? Now why?


Deno was announced nearly 2 years ago by the original Node.js creator Ryan Dahl at JSConf EU. Watch the talk's YouTube video, it's very interesting and it's a compulsory watch if you're involved with Node.js and JavaScript in general.

Every project manager must decide. Ryan found some early decisions in Node regrettable. Software is also changing and today JavaScript is a very different language than it was when Node started back in 2009. Think of the new features of ES6/2016/2017, and so forth.

So he started a new project to build some kind of second wave of JavaScript-powered side-apps for servers.


Do wen need to learn Deno?


This is an enormous issue.

It's a big effort to learn something new, like Deno. My suggestion is that if you start with server-side JS now and have no node yet, and have never written any TypeScript, I would start with Node.

Nobody has ever been shot for selecting Node.js (paraphrasing a famous quote).

But if you love TypeScript, don't rely on a gazillion npm packages in your projects and you want to use them wherever you 're looking for, hey Deno might be what you are looking for.


Will it substitute Node.js?


No. No. Node.js is a giant, well-established, amazingly well-supported technology that will survive for decades to come.


TypeScript First Class Support


  • Deno is written in Rust and TypeScript, two of today's very fast growing languages.

  • Specifically, being written in TypeScript means we get a lot of TypeScript benefits even if we might choose to write our code in plain JavaScript.

  • And running TypeScript code with Deno needs no compilation stage-Deno does that for you automatically.

  • You don't have to write in TypeScript but the fact that Deno 's core is written in TypeScript is massive.

  • First, there's an growing percentage of JavaScript programmers who love TypeScript.

  • Second, a lot of software knowledge written in TypeScript can be inferred from the tools you use, including Deno.

  • For example, when we code in VS Code (which of course has a close integration with TypeScript because both are built at MicroSoft), we can get advantages such as type checking while we write our code, and advanced IntelliSense features. In other words the writer will be of great help to us.


Similarities and differences with Node.js


Since Deno is essentially a substitute for Node.js, direct comparison of the two is useful.


Similitudes:

  • These are both developed using the V8 Chromium Engine

  • All are useful for server-side development with JavaScript


Differences:

  • This node is written in both C++ and JavaScript. Deno is written in TypeScript, Rust and.

  • Node has an official manager of package called npm. Deno does not, and allows you to import any ES Module from URLs instead.

  • Node makes use of the CommonJS syntax to import pacakges. Deno uses the official form, the ES modules.

  • Deno uses modern ECMAScript features in its API and standard library, while Node.js uses a standard library based on callbacks, and has no plans to update it.

  • Deno offers by permission a security layer for the sandbox. A software may only access the user's executable-set permissions as flags. A Node.js program has access to whatever the user can access.

  • Deno has long considered the idea of compiling a program into an executable that you can run without external dependencies, such as Go, but it's not yet a thing. That would change the game.

No package manager:


There are pros and cons of having no package manager and having to rely on URLs for hosting and importing packets. I really like the pros: it's very flexible, and without publishing it on a repository like npm we can create packages.


I think some sort of package manager is going to emerge but there's nothing formal yet out there.


The Deno website offers 3rd party packages with application hosting (and thus delivery via URLs): https:/deno.land/x/


All clear let's install Deno !!
0 views
Never Miss a Post. Subscribe Now!

Contact Us: nawabblog@gmail.com

Location : Bangalore India.

© 2019 proudly created  by Nawab Ahmad. 

  • Nawab Ahmad
  • Grey Twitter Icon
  • Nawab Ahmad