/hardware-store

Golang API REST com MySQL e Docker

Primary LanguageGo

Golang API REST with MySQL & Docker

  • Install

    • Go
    • Docker
    • docker-compose
  • Usage:

    cd $GOPATH/src

    git clone https://github.com/EricLau1/hardware-store.git

    cd hardware-store

    mkdir data

    sudo docker-compose up -d

Set up test database

    docker exec -it mysql_docker bash -l

    mysql -u root -p
  • Copy and paste the sql script: supertest_data.sql

Api endpoint inside the container:

  • localhost:5000/products

Api endpoint out of container:

    cd $GOPATH/src/hardware-store

    go build -o main .

    ./main -p=8080
  • localhost:8080/products