Writing a Web Server with Oak
Learn how to add event listeners to an Oak application.
We'll cover the following...
Using Oak for web applications
We decided that we’ll be using Oak in this course. In this lesson, we’ll rewrite part of our web application so that we can use it instead of the HTTP module from the standard library.
Let’s open src/web/index.ts
and start tackling it step by step.
Following Oak’s documentation, the only thing we’ll need to do is instantiate the Application
object, define a middleware, and call the listen
method. Let’s do it:
- Add Oak’s import to the
deps.ts
file:
export {Application} from "https://deno.land/x/oak@v6.3.1/mod.ts"
Note: If you’re using VSCode, then you’ve probably noticed that there’s warning saying that it couldn’t find this version of ...