This service exposes an HTTP endpoint for receiving a JSON file containing a list of ports and updates or creates thoses ports to a database.
Running the service
The entrypoint of the service is located at cmd/api package.
The following command starts the application locally at 8080 HTTP port:
$ cd cmd/api && PORT=8080 go run main.go
There’s a Dockerfile for this service in build folder.
The following command builds the application at 8080 HTTP port:
$ docker build -f build/Dockerfile -t ports-service .
The following command starts the container:
$ docker run -it -p 8080:8080 ports-service
This service has unit tests for all packages inside internal folder.
The following command runs all the tests available:
$ go test -v -cover ./...
The following command runs a manual integration test:
$ curl http://localhost:8080/ports -F "[email protected]" -v
ports.json is the path for the file containing a list of ports.