This is a simple GoLang API that provides Get/Post/Patch services for docuements in the People collection. This API uses data from a backing Mongo Database, and supports a VueJS Single Page Appliaction.
The OpenAPI specifications for the api can be found in the docs
folder, and are served here
make install
make test
make local
Serves up the API locally with a backing mongodb database, use ctrl-c to exit
make container
This will build the new container, and start the mongodb and API container ready for testing. The test script ./test/test.sh is also run so you should see information about an inserted document. You will get a failed. Received HTTP code 000
message if there are problems
make stepci
This will run the stepci tests, and expectes to find the API with backing test data at localhost:8082. If you need to start the database and api before running the test you can use
make blackbox
make testdata
Generattes loads of test data, ctrl-c to exit
If you want to do more manual testing, here are the curl commands to use
This endpoint supports the promethius monitoring standards for a healthcheck endpoint
curl http://localhost:8082/api/health/
curl http://localhost:8082/api/config/
curl http://localhost:8082/api/enums/
curl http://localhost:8082/api/partners/
curl http://localhost:8082/api/mentors/
curl http://localhost:8082/api/person/
curl http://localhost:8082/api/person/aaaa00000000000000000000
curl -X POST http://localhost:8082/api/person/ \
-d '{"userName":"Foo", "description":"Some short description"}'
curl -X PATCH http://localhost:8082/api/person/aaaa00000000000000000021 \
-d '{"description":"Some long description"}'
The api/config/
endpoint will return a list of configuration values. These values are either "defaults" or loaded from an Environment Variable, or found in a singleton configuration file of the same name. Configuration files take precidence over environment variables. The variable "CONFIG_FOLDER" will change the location of configuration files from the default of ./
The api/health/
endpoint is a Promethius Healthcheck endpoint.
The Dockerfile uses a 2-stage build, and supports both amd64 and arm64 architectures. See docker-build.sh for details about how to build in the local architecture for testing, and [docker-push.sh] for details about how to build and push multi-architecture images.