https://github.com/qba73/http
HTTP Server accepting cert/key as byte slices
https://github.com/qba73/http
go go-library http-server tls
Last synced: about 1 year ago
JSON representation
HTTP Server accepting cert/key as byte slices
- Host: GitHub
- URL: https://github.com/qba73/http
- Owner: qba73
- License: mit
- Created: 2022-11-05T15:49:33.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-29T18:05:11.000Z (about 3 years ago)
- Last Synced: 2025-02-03T12:16:31.742Z (over 1 year ago)
- Topics: go, go-library, http-server, tls
- Language: Go
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://pkg.go.dev/github.com/qba73/http)
[](https://github.com/qba73/http/actions/workflows/go.yml)

[](https://goreportcard.com/report/github.com/qba73/http)
# http
```http``` is a Go library for running the HTTP Server configured to use TLS.
## Using the Go library
Import the library using:
```go
import httpb "github.com/qba73/http"
```
Start a default http server with TLS:
```go
err := httpb.ListenAndServeTLS(":443", cert, key, handler)
if err != nil {
log.Fatalln(err)
}
```
The function signature is the key difference compared with the same func from the http standard library. The function takes a cert and a key which are slices of bytes (```[]byte```), not paths to files located in the filesystem!
Using ```[]byte``` types instead of paths allows passing a cert and a key directly to the function without creating a temporary directory to store the content of the cert and key in files in the filesystem.