From the root directory
go run cmd/main.go
remember to replace in db/conn.go the "go_db" for "localhost" for development
- to build the image
sudo docker build -t go-products-management .
- to run the database isolated (for development)
sudo docker compose up -d go_db
- to run both images after build
sudo docker compose up -d
- Create product table
CREATE TABLE product (
id SERIAL PRIMARY KEY,
product_name VARCHAR(255) NOT NULL,
price NUMERIC(10, 2)
)
- Insert product into product table
INSERT INTO product (
product_name,
price
)
VALUES (
'Weed',
4.20
)