Get the highlights in your inbox every week.
Start programming in Deno, an alternative to Node.js | Opensource.com
Start programming in Deno, an alternative to Node.js
Get to know Deno's CLI, permissions, and how to write a Hello World program.
- Deno's command-line interface (CLI)
- Permissions in Deno
- Hello World in Deno
Deno is a command-line program, and mastering its CLI can help you use its features. For example, you can type
deno help to see all the help options from 25,000 feet.
Watch this video to learn more about the tricks that Deno's CLI can do:
Permissions in Deno
When Ryan Dahl created Node.js, it proved to be wildly popular among not only web developers but programmers from many industries and hobbies. However, there are critiques about its security model. Ryan has designed Deno with security in mind, so a Deno module does not have file, network, or environment access unless you specifically enable it.
For example, in the following script,
hello-deno.js is given only
deno run --allow-read hello-deno.ts
Permission might not be an easy subject to grasp, but Deno makes it simpler. If you are interested in learning more about how Deno handles permissions, please watch this video.
Say "Hello, World" in Deno
When learning a new programming language, it's common to start by writing a "hello, world" program. Here's how to do that in Deno.
In TypeScript, the file contents will be exactly the same, but the file has a different extension.
However, as the script gets more complicated, you will begin to see some differences. This video offers a more complex example of how you can say "hello, world" in Deno:
That's it for now! I'll share more articles covering more advanced Deno uses on Opensource.com in the future.