https://github.com/scharissis/go-server-skeleton
An opinionated skeleton implementation of a Go http web server.
https://github.com/scharissis/go-server-skeleton
go golang http server skeleton skeleton-application template
Last synced: 3 months ago
JSON representation
An opinionated skeleton implementation of a Go http web server.
- Host: GitHub
- URL: https://github.com/scharissis/go-server-skeleton
- Owner: scharissis
- License: mit
- Created: 2020-05-26T02:56:42.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-05-19T19:56:34.000Z (almost 3 years ago)
- Last Synced: 2024-06-20T11:51:00.573Z (almost 2 years ago)
- Topics: go, golang, http, server, skeleton, skeleton-application, template
- Language: Go
- Homepage:
- Size: 25.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Skeleton Go Web Server
![Build (Go)]()
[](https://goreportcard.com/report/github.com/scharissis/go-server-skeleton)
[](https://pkg.go.dev/github.com/scharissis/go-server-skeleton?tab=doc)
A very simple template for a golang web service.
It is opinionated and intended to act as an example of best practices.
## Building & Running
- Build
`./build.sh` (recommended), OR
`go build ./...`
- Run
`go run main/skeleton.go`
## What's here?
1. A web server, which:
- Exposes one method (/api/answer), which allows GET and POST and responds with JSON
```
GET /api/answer // 'Hello!'
POST /api/answer 'Stefano' // 'Hello, Stefano!'
```
- Has middleware to limit the type of HTTP request a method will allow
- Shuts down gracefully
1. An example 3rd party service client library (skeleton/numbers)
1. Tests
### Design choices at a glance
- Server shuts down gracefully
- Routes go in their own file
- API unit tests use **testify**: github.com/stretchr/testify/assert
## Contributing
Contributions are very welcome!
Submit a pull request with:
1. New functionality or edits.
2. Tests covering the above.
3. Reasoning as to why it should be included.