Deno Standard Library

Learn how to use the Deno standard library and other external modules with URL imports

Deno standard library#

Deno has a standard library (std) available for use which you can findhere. The Deno standard library is structurally based on Golang's standard library, but due to language differences the implementation might vary where needed.

In this part, we will look at three modules from Deno std, one for changing the console output color, another for generating aUUID, and one for creating an HTTP server.

Deno does not use a centralized package repository like npm to install third-party modules; instead the modules are imported using a URL, and cached locally. We can start by adding the first import to our main.ts file in our work directory.

We use explicit versioning of the file to make sure that sudden breaking changes does not occur. If you do not care about this, and just want the latest available, you can simply import it as such:

Although running the application will cache the files and dependencies, you sometimes want to only cache the dependencies without executing any code. For this, we can use the deno cache command.

 

This page is a preview of Build and deploy a REST API with Deno

Start a new discussion. All notification go to the author.