Skip to content

Repository files navigation

go-server

A small, well-structured Go HTTP server and companion HTTP client.

Go module: github.com/rahilsh/go-server (requires Go 1.25+)

Layout

cmd/
  server/   # HTTP server entrypoint
  client/   # HTTP client entrypoint
internal/
  server/   # routes, handlers, server setup (testable core)

Build & run

make build        # -> bin/server, bin/client
make run          # run the server (default :3000)
make run-client   # run the client

Or directly:

go run ./cmd/server
go run ./cmd/client

Configuration

Variable Default Used by
SERVER_ADDR :3000 server
CLIENT_URL https://jsonplaceholder.typicode.com/todos/1 client

Endpoints

curl localhost:3000/        # -> Hello world!
curl localhost:3000/books   # -> {"total":0,"count":0,"books":[]}

Development

make test         # go test -race ./...
make test-cover   # coverage report
make lint         # golangci-lint
make vet          # go vet
make fmt          # gofmt -w .

Docker

make docker
docker run --rm -p 3000:3000 go-server:latest

About

Simple golang server

Resources

Contributing

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Used by

Contributors

Languages