Build a Simple Rest API with Deno and Express
Nội Dung Chính
Build a Simple Rest API with Deno and Express
Deno is a simple, modern, and secure runtime for JavaScript and TypeScript that uses V8 and is built in Rust.
Features of Deno
- Secure by default. No file, network, or environment access, unless explicitly enabled.
- Supports TypeScript out of the box.
- Ships only a single executable file.
- Has built-in utilities like a dependency inspector (deno info) and a code formatter (deno fmt).
- Has a set of reviewed (audited) standard modules that are guaranteed to work with Deno: deno.land/std
Deno does not use NPM or node modules to manage the packages. Instead, we link third party packages using browser compatible URL.
Installing Deno
If you are using a Mac or Linux based system. Open your terminal and copy/paste the following command to install Deno.
curl -fsSL https://deno.land/x/install/install.sh | sh
If you are using Windows OS, just open the power shell and run this command.
Once installed, you can verify the installation by running the following command.
deno --version
Let’s run our hello world program an official example from Deno. Copy the command shown below and run it in your terminal.
You should see the following response.
Welcome to Deno 🦕
To help you further your exploration in Deno, i recommend you go through this article The Deno Handbook: A TypeScript Runtime Tutorial with Code Examples
List of Permission flag
As deno is secure by default it doesn’t have any permission enable. These flags will be useful for permission while running a file.
--allow-env:
Allow environment access.--allow-hrtime:
Allow high-resolution time measurement.--allow-net:
Allow network access.--allow-plugin:
Allow loading plugins.--allow-read:
Allow file system read access.--allow-run:
Allow running subprocesses.--allow-write:
Allow file system write access.--allow-all:
: Give all access.
Yay! we can come to the end of this brief introduction to Deno and we would move to our focus for this article. I hope you would enjoy the ride ❤❤❤