Learn how to use MySQL in Deno and Oak

I recently wrote about how to make a Todo API in Deno + Oak (without using a database). You can find the repo under chapter_1:oak.

This tutorial picks up where the other left off, and I’ll go over how to integrate MySQL into a Deno and Oak project.

If at any time you want to see the entire source code used in this tutorial, it’s available at chapter_2:mysql. Feel free to give it a star on GitHub if you like it.

I’m assuming that you already completed the last tutorial mentioned above. If not, check it out here and come back when you’re finished.

Before we start, make sure that you have a MySQL client installed and running:

I wrote a small guide for Mac OS users on setting up MySQL because I struggled with it as well. Check it out here.

If you are on a Windows machine you can use the same tools or you can also use XAMPP to have a MySQL instance running in your dashboard.

Once you have a MySQL instance running we can begin our tutorial.

Let’s Begin

Assuming that you’re coming from this article, Todo API in Deno + Oak (without using a database), we will do the following:

  • Create a MySQL database connection
  • Write a small script that resets the database every time we start our Deno server
  • Perform CRUD operations on a table
  • Add the CRUD functionality to our API controllers

#deno #node #mysql #database #web-development

How to Integrate MySQL into Deno and Oak Project
2.20 GEEK