LoopBack 3 – Simple API with MySQL Example

Expose your MySQL Database as a REST service with LoopBack 3 (Node.js Open API Framework)

This post is continuation of previous post https://kenanhancer.com/2019/09/09/loopback-3-simple-api-example/

So if you want to start from beginning, read that one as well.

Follow this link https://kenanhancer.com/2019/09/12/mysql-docker-container-exercise/ to create a MySQL container 🙂

LoopBack MySQL example will not start wihout running the following code in MySQL Database container. So, run the following command in it.

ALTER USER root IDENTIFIED WITH mysql_native_password BY 'password';

You can find LoopBack 3 project in the following repository. After clonning switch to mysql branch 🙂 or run the following command.

git checkout mysql

https://github.com/kenanhancer/loopback3-simple-api.git

MySQL Docker Container Exercise

You can up and run MySQL Docker container in your local machine and later connect from mysql CLI to query your database.

Run the following command in your terminal to up and run a MySQL Database Docker container.

docker run -p 3306:3306 --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:latest

Follow the following link for more details

https://hub.docker.com/_/mysql

There are more practice in this video 🙂