Skip to main content

Posts

Showing posts with the label Deno

RESTful CRUD API with Deno, Oak and MongoDB

In this post, we are going to build a RESTful CRUD API with Deno, Oak and MongoDB as database. In the previous article, we discussed how to install deno in your local machine and start using Deno. If you haven’t read that article, please read the article below and install the deno first. Getting started with Deno, Your first app Hello Deno. Let's install Deno. Deno ships as a single executable with no dependencies. You can install it using the installers… blog.shashi.dev After installing the Deno, we will start building the restful crud api’s. We will use o ak  microframework. Some of the other deno microframeworks are: abc deno-drash deno-express oak pogo servest In this article we will be using oak, which is inspired by koa. Setting up the project: Create a new directory called  restful-api-deno mkdir restful-api-deno 2. After c r eating the directory just  cd  into the directory cd restful-api-deno 3. Create a new file  server.ts  and paste the followi...

Getting started with Deno, Your first app Hello Deno.

Let’s install Deno. Deno ships as a single executable with no dependencies. You can install it using the installers below, or download a release binary from the  releases page . Installing deno in Linux: curl -fsSL https://deno.land/x/install/install.sh | sh Set the path export DENO_INSTALL="/home/user/.deno" export PATH="$DENO_INSTALL/bin:$PATH" Once its done lets verify the installation. deno --version and you should be able to get the deno version. Congratulations, deno is installed. Now as a tradition we will start with Hello Deno project. Create a folder called hello-deno. mkdir hello-deno cd hello-deno Create a file index.js touch index.js Put the following content in the index.js console.log('Hello Deno'); Now we can run our program from terminal. deno run index.js You shou l d be able to get the following output Hello Deno Congrats. You have just completed your Hello World with Deno. We will create more real-life deno projects in the next article. ...

Deno: Standard Libraries Overview

Deno comes with a set of standard libraries to help developers and make their lives easier. I felt it is inspired by languages like Go and Python. Despite being pretty young Deno's standard library is pretty extensive. These libraries are Deno-approved and don’t have any other external dependencies. List of Deno’s standard libraries: archive  tar archive utilities async  async utilities bytes  helpers to manipulate bytes slices datetime  date/time parsing encoding  encoding/decoding for various formats flags  parse command-line flags fmt  formatting and printing fs  file system API hash  crypto lib http  HTTP server io  I/O lib log  logging utilities mime  support for multipart data node  Node.js compatibility layer path  path manipulation ws  websockets In the upcoming blog posts, we will dig deeper into these standard libraries. We will use some of the core libraries and see how they help developers to b...

Node.js VS Deno: Will Deno replace Node.js?

  Once Deno released there were so many questions and speculations related to Deno and Node.js, one of them was is Deno going to replace node.js? I think Node.js is pretty much mature and well-established technology. Node.js is also incredibly supported by companies and the community. So for sure, Node.js will be around for a while and Deno is not going to replace it overnight. Since Deno is like a replacement for Node.js, Let's look at some of the similarities between them. Both Deno and Node.js are developed upon the Chromium V8 Engine. Both are built to develop server-side applications. Let's dig into the differences between them: Node.js is written in C++ and JavaScript. Deno is written in Rust and TypeScript Node.js has a package manager called npm. Deno doesn’t have a package manager and it lets you import modules directly via URL. Node uses the CommonJS syntax for importing packages deno uses modern ECMAScript features in all its API and standard library, while Node.js ...

What is Deno?

Deno  is a simple, modern, and secure runtime for JavaScript and TypeScript that uses V8 and is built in Rust. If you are familiar with  Node.js , the server-side JavaScript framework, then Deno should be a no brainer for you. Deno is also a server-side JavaScript framework except that it has been improved in many ways. The list of features that Deno offers are: Built around modern JavaScript features It has an extensive standard library It has first-class TypeScript support. This brings a huge advantage in many different ways such as you don’t have to separately compile TypeScript, it’s automatically done by Deno. Secure by default. No file, network, or environment access, unless explicitly enabled. It has no package manager It has a first-class await It as a built-in testing facility It aims to be browser-compatible as much as it can, for example by providing a built-in fetch and the global window object Ships only a single executable file. After using Deno, Node.js looks ...