Skip to content

Sph3ricalPeter/go-service-base

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

docker compose up --build

There's an endpoint /alive:

curl http://localhost:8080/alive
# prints out '{"message":"Yo I'm alive!"}'

Calling the endpoint will print:

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

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!"}'

About

A simple (almost minimal) service written in Go with a multistage docker build & 15MB container size

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages