REST API with unit tests and coverage percentage API developed from a Car CRUD, where unit tests are performed and their percentage of coverage API developed in golang using swagger to create test environment
go get github.com/gin-gonic/gin
go get github.com/jinzhu/gorm
go get github.com/jinzhu/gorm/dialects/postgres
go get github.com/joho/godotenv
GET
: GET all carsPOST
: POST create a new car
GET
: GET a carPUT
: PUT update a carDELETE
: DELETE a car
{
"name": "Sentra", "brand": "Nissan", "year": "2022/12/12"
}
{
"ID": 1, "name": "Skyline", "brand": "Nissan"
}
gotests -all -w .
go test -v ./...
-
go test -coverprofile name
-
go tool cover -html=nameCoverProfile