Introduction to the Runtime and Standard Library
Learn about the content outline and the topics covered in this chapter.
We'll cover the following
What we’ll learn
Now that we know enough about Deno, we’re in a good place to write a few real applications with it. In this chapter, we’ll use no libraries because its primary purpose is to present the runtime APIs and the standard library.
We’ll write small CLI utilities, web servers, and more, always leveraging the power of what the official Deno team created, with no external dependencies.
The Deno
namespace will be our starting point because we believe it makes sense to explore what the runtime includes first. Following this idea, we’ll also look at the web APIs that Deno shares with the browser. We’ll use setTimeout
to addEventListener
, fetch
, and so on.
Still, in the Deno
namespace, we’ll get to know the program lifecycle, interact with the filesystem, and build small command-line programs. Later, we’ll get to know buffers and understand how they can be used to asynchronously read and write.
We’ll then take a quick turn into the standard library, and we’ll go through some useful modules. This chapter doesn’t aim to replace the standard library’s documentation; it will present some of its capabilities and use cases. We’ll get to know it while we write small programs.
On this journey through the standard library, we’ll use modules that deal with the filesystem, ID generation, text formatting and HTTP communication. Part of it will be an introduction to what we’ll explore in more depth in later chapters. We’ll finish this chapter by writing our first JSON API and connecting to it.
Get hands-on with 1200+ tech skills courses.