Connect to MySQL on Golang and Create Docker-Compose file

preview_player
Показать описание
Now that we have a Dockerfile for our Go app from our last video, we want to run the Go app along with a MySQL container.

In this video, we will extend our Go app to insert & get users into/from the database before writing our docker-compose yaml. We will validate everything works at the end of the video.

Рекомендации по теме
Комментарии
Автор

0:00 Introduction
0:22 Start: extend the Go app to integrate MySQL
0:33 Change ID to UUID
0:42 Create a DB with sql.Open()
1:13 Defining host in the db source: running mysql as stand-alone container vs. in a docker-compose
2:54 Import mysql driver
3:14 Extend ServeHTTP to accept POST requests
3:33 Add the createUser() and getUser() handlers
5:26 Go microservices project folder structure
6:35 Modify existing Dockerfile
7:25 Write docker-compose.yaml
8:24 expose vs. ports field
12:34 Create a `users_db` database and a `users` table in the mysql container
14:13 Validate the app by sending GET and POST on localhost:8080/users using curl

dhij
Автор

I had an issue with the app connecting to the DB. One minute into your video my problem is solved.

TerenceSilonda
Автор

The text is very small. It’s hard to see.

IkraamDev
Автор

I have question what's best practice and natural way to automate last part, the database stuff, automating database initialization stuff like creating roles, tables etc. and even fill it with previous data (if any)

thanks in advance 💟

sinamobasheri
Автор

Your voice audio only plays in my left ear

DJMerrell