modulepackage
0.0.0-20240923035301-27c1aafd2150
Repository: https://github.com/billzayy/crud-go.git
Documentation: pkg.go.dev
# README
CRUD GoLang with Swagger
After run docker-compose
, you can access http://localhost:<port>/swagger/index.html
to open swagger UI.
Require:
- Installed Go
- Installed Docker
Run without Docker :
-
First we need to create .env file with copy some code:
PORT=<PORT> DBPATH="<username>:<password>@tcp(<ip>:<port>)/<databases-name>"
-
Second, We run command :
air
If you can't run
air
, so please install air :go install github.com/cosmtrek/air@latest
Run
air -v
to check air in your local.
or
Run with Docker Compose:
docker-compose up -d
To run access and create table in database:
-
You need to copy this line into your terminal:
docker exec -it db bash
-
Next, access into Mysql Server with:
mysql -u root -p
After that, type
password
to input the password -
Then, to use a database named golang. Copy this :
use golang;
-
Finally, go to folder
database/db/init.sql/CreateUser.session.sql
or click here! and copy all SQL Statements into your terminal. -
To check table exists, type this command :
desc User;
If your mysql server still don't have a User table, rerun docker compose and to it again !!!
# Packages
No description provided by the author
Package docs Code generated by swaggo/swag.
No description provided by the author
No description provided by the author