# Introduction
Cats demo REST API used to manage a local database of 🐈.
go run .
Then you can browse:
- the home page: http://localhost:8080
- the Swagger UI : http://localhost:8080/swagger/
- the logs : http://localhost:8080/logs
The go CLI supports go build
to produce an exacutable and will guide you through compilation errors.
A Dockerfile needs to be created at the repository root.
You can derive from scratch
, then COPY
the sources into the image and build them.
The main command of the image should simply execute the executable obtained after building.
A more advanced solution can be achieved with a staged build.
Build command:
docker build -t my-image-name .
Listing the images:
docker images
Running a container:
docker run -it <imageID>
Play also with:
inspect ps stop rm rmi
Test files have to be postfixed with _test.go
for the command go test .
to play them.
Test files have to be postfixed with _test.go
for the command go test ./test/apitests
to play them.
Also you will need to run the server at the same time in another tab.
Done following Swagger official doc.
The Swagger UI consumes only JSON api specification, the function yml2json
has been made to convert the YML format into JSON.