Skip to content
This repository has been archived by the owner on Mar 31, 2020. It is now read-only.

Commit

Permalink
Move example code to README (#5)
Browse files Browse the repository at this point in the history
The code exampleServer.go was added so that dep can correctly identify this repo as a Go repo. However, the file is not really used and the example code is better put into the README as a reference.

This is replaced with a file named dep.go and a comment explaining the purpose of the file.
  • Loading branch information
abeltay authored Dec 8, 2017
1 parent 8c01089 commit 94f8525
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,23 @@ Cryptographically random strings to be used for things like session IDs.
## Server
Starts a HTTP server with graceful shutdown when receiving `SIGINT` or `SIGTERM`

Example code:
```
import (
"log"
"time"
"github.com/moexmen/gokit/web"
)
func main() {
s := web.Server{
Addr: ":8080",
Timeout: 5 * time.Second,
}
log.Println("Starting...")
log.Println(s.ListenAndServe())
}
```

[Docker Stop](https://docs.docker.com/compose/reference/stop/) has a default timeout of 10 seconds. We recommend to use a timeout lower than 10 seconds if you use Docker.
2 changes: 2 additions & 0 deletions dep.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// This file is used to ensure that dep correctly identifies this as a Go repository.
package main
17 changes: 0 additions & 17 deletions exampleServer.go

This file was deleted.

0 comments on commit 94f8525

Please sign in to comment.