-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from ichtrojan/prepare-release
v1.0.0
- Loading branch information
Showing
2 changed files
with
80 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# Horus 𓂀 | ||
|
||
<img width="1461" alt="horus-hero" src="https://user-images.githubusercontent.com/5338836/112303700-e2a23480-8c9c-11eb-9e47-9b0634e5b1e5.png"> | ||
|
||
## Introduction | ||
|
||
Horus is a request logger and viewer for [Go](https://golang.org). It allows developers log and view http requests made to their web application. | ||
|
||
<img width="1461" alt="horus-big-brother" src="https://user-images.githubusercontent.com/5338836/112304004-44629e80-8c9d-11eb-930b-bdf32448673c.png"> | ||
|
||
## Installation | ||
|
||
Run the following command to install Horus on your project: | ||
|
||
```bash | ||
go get github.com/ichtrojan/horus | ||
``` | ||
|
||
### Initiate horus | ||
|
||
```go | ||
package main | ||
|
||
import github.com/ichtrojan/horus | ||
|
||
func main() { | ||
listener, err := horus.Init("mysql", horus.Config{ | ||
DbName: "{preferred_database_name}", | ||
DbHost: "{preferred_database_host}", | ||
DbPssword: "{preferred_database_password}", | ||
DbPort: "{preferred_database_port}", | ||
DbUser: "{preferred_database_user}", | ||
}) | ||
} | ||
``` | ||
|
||
>**NOTE**<br/> | ||
> Supported database adapters include **mysql** and **postgres** | ||
### Serve dashboard (optional) | ||
|
||
<img width="1461" alt="horus-message-received" src="https://user-images.githubusercontent.com/5338836/112304136-69571180-8c9d-11eb-80db-167c6e8c4d3c.png"> | ||
|
||
```go | ||
... | ||
if err = listener.Serve(":{preferred_port}", "{preferred_password}"); err != nil { | ||
log.Fatal(err) | ||
} | ||
... | ||
``` | ||
|
||
### Usage | ||
To enable horus to listen for requests, use the `Watch` middleware provided by horus on the endpoints you will like monitor. | ||
|
||
```go | ||
... | ||
http.HandleFunc("/", listener.Watch(func(w http.ResponseWriter, r *http.Request) { | ||
w.Header().Set("Content-Type", "application/json") | ||
|
||
response := map[string]string{"message": "Horus is live 👁"} | ||
|
||
_ = json.NewEncoder(w).Encode(response) | ||
})) | ||
... | ||
``` | ||
|
||
You can explore the implementation in the [example folder](https://github.com/ichtrojan/horus/tree/main/example). | ||
|
||
## Built by | ||
|
||
* Toni Akinmolayan - [twitter](https://twitter.com/toniastro_) [GitHub](https://github.com/toniastro) | ||
* Michael Trojan Okoh - [twitter](https://twitter.com/ichtrojan) [GitHub](https://github.com/ichtrojan) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters