https://github.com/somebadcode/gracefulhttp
A simple HTTP server that will gracefully shut down if an error occurs or a signal is received.
https://github.com/somebadcode/gracefulhttp
go golang golang-examples http-server
Last synced: 7 months ago
JSON representation
A simple HTTP server that will gracefully shut down if an error occurs or a signal is received.
- Host: GitHub
- URL: https://github.com/somebadcode/gracefulhttp
- Owner: somebadcode
- License: unlicense
- Created: 2020-10-25T13:19:59.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-11-29T14:30:10.000Z (about 4 years ago)
- Last Synced: 2025-03-24T17:53:02.505Z (10 months ago)
- Topics: go, golang, golang-examples, http-server
- Language: Go
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#### Simple HTTP server with graceful shutdown
This is a simple HTTP server that allows for graceful shutdowns by using context. I've only included one third party
library which I use for logging, so it has nothing to do with the solution in and of itself. I have also included a
small example of how to embed files into the final binary and in this case it's part of a small demo web application.
You can freely use this project as a starting point or as a reference on how can you use `context` to gracefully handle
signals and other concurrent code in general.
### Contribution
Anyone can contribute as long as it doesn't add new functionality or anything that requires a change of license.
I only accept fixes and improved solutions since this is only meant as a starting point or as a reference for other
projects.