Site icon Webnewswire

What is Deno? Will it replace NodeJS – Node vs Deno

Deno is a simple, modern and secure runtime for JavaScript and TypeScript that uses Chromium V8 Engine and is built in Rust Programming Language.

Installing Deno
Go to deno.land

Now click on install menu in the deno.land’s menubar

Now, based on Your OS , you can install by using listed commands.Suppose , you have Mac OS , So Copy the command as listed for Mac OS ,then open the terminal and pass the command you copy ,then press enter

Now , you have to set path ,So ,open your bash_profile by typing nano .bash_profile, then press ENTER , Then copy these two lines to your .bash_profile given below:
PastedGraphic5(2)
Now , Hit ctrl + X to save the .bash_profile

Now , You have successfully added the deno path

Now , You can verify your deno Installation by typing deno –version in the terminal to check your current deno’s version.

Also , you can type demo –help in the terminal to check all the deno commands

Also, you can open the deno shell in the terminal by just typing deno and then just press enter.Then you can execute any demo’s Code there.

Now, Lets Start with first Deno’s Program
For this , you have to install vs code through https://code.visualstudio.com/

Now, Open VS Code , goto extension , then install deno plugin as shown :

Now, create a new folder named as Deno where we will write our first program.

Deno has a supports of JavaScript an TypeScript. So you can either write JS or TS. So, we will create a file named as one.ts

Now, lets write code in our one.ts file.This is our type script code :

Now , we have to run this code , so open terminal in vs code by right clicking on file (one.ts) , then navigate to terminal :

Now, terminal will be opened in the bottom of the VS Code.

Now, in order to run our code , type deno run one.ts(#your_file_name) , Then hit enter button,Then your program will be compiled in first line, and you will get output ion second line

Now , if you try to run your file again without changing your code , then it will not re-compile your code and will just return the result. Code will be only compiled if you made any change in your code

Read Full Article Here – https://brain-mentors.com/what-is-deno-will-it-replace-nodejs-node-vs-deno/

Exit mobile version