https://github.com/sph3ricalpeter/go-service-base
A simple (almost minimal) service written in Go with a multistage docker build & 15MB container size
https://github.com/sph3ricalpeter/go-service-base
docker golang rest-api service
Last synced: about 1 month ago
JSON representation
A simple (almost minimal) service written in Go with a multistage docker build & 15MB container size
- Host: GitHub
- URL: https://github.com/sph3ricalpeter/go-service-base
- Owner: Sph3ricalPeter
- License: mit
- Created: 2024-03-06T18:02:33.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-10T23:04:49.000Z (over 1 year ago)
- Last Synced: 2025-02-15T12:17:36.936Z (over 1 year ago)
- Topics: docker, golang, rest-api, service
- Language: Go
- Homepage:
- Size: 8.79 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Simple GO Service
A simple (almost minimal) service written in GO with a multistage docker build & 15MB container size
## Usage
Simply run the following command to start the service:
```shell
docker compose up --build
```
There's an endpoint `/alive`:
```shell
curl http://localhost:8080/alive
# prints out '{"message":"Yo I'm alive!"}'
```
Calling the endpoint will print:
```text
2024/10/10 22:55:27 "GET http://localhost:8080/alive HTTP/1.1" from 172.18.0.1:60952 - 200 24B in 40.452µs
```
Endpoint `/private` requires an api key header, default is `123123`
```shell
curl -X GET "localhost:8080/private" -w "%{http_code}"
# prints out '401'
curl -X GET "localhost:8080/private" -H "X-API-KEY: 123123"
# prints out '{"message":"I'm private!"}'
```