Up and Running with Deno

nader dabit
Instructornader dabit

Share this video with your friends

Send Tweet
Published 3 years ago
Updated 2 years ago

In this video, we start by going to Begin.com and creating a new Deno app. We then clone the repo, inspect the code, and modify the response from HTML to JSON data. Next, we deploy the updates in an automated CI / CD process by merging the updates to our master GitHub branch.

Nader Dabit: [0:01] We'll get started by going to begin.com. Here, we'll go ahead and sign up for a new account. Then, we'll authorize using GitHub.

[0:14] Once in the dashboard, we can now click on Create new app. Here, we'll choose Deno and then choose the Hello World example app. We'll give the app a name and then click Create Hello World app. Now the app will begin deploying and we can go ahead and click on the link to our GitHub repo to view the code.

[0:51] Once the initial deployment is done, we can click on Staging to view the live app.

[1:01] Next, we'll go back to GitHub and clone the repository. We'll change into the new directory and open the project in our text editor. Here, we'll open src/index.ts. As of now, the response body is set to some stringified HTML.

[1:24] For the return value in the function, we return headers as well as the body. You'll also see that in the boilerplate, we have a couple of other example responses. Let's now update the response to return some JSON data. To do so, we'll update the body to return an object and the object will give it a message field of "Hello World."

[1:47] Next in the function handler, we'll update the headers content type to be application/json. For the body, we'll return the stringified version of the body. To deploy these changes, we can push the updates to GitHub to kick off a new deployment.

[2:20] In the begin dashboard, you should see the staging branch undergoing a new build. Once the build is completed and we update, we should now see the stringified data.