Skip to content

Commit ab86cc1

Browse files
authored
Merge pull request #5 from DizoftTeam/feature/doc
add documenentation
2 parents bd95421 + 6152fa1 commit ab86cc1

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

README.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# Go JsonRpc Server
22

3-
Base implementation of JSONRpc in Go
3+
[![GitHub go.mod Go version of a Go module](https://img.shields.io/github/go-mod/go-version/DizoftTeam/jsonrpc_server.svg)](https://github.com/DizoftTeam/jsonrpc_server)
4+
[![GitHub tag](https://img.shields.io/github/tag/DizoftTeam/jsonrpc_server.svg)](https://GitHub.com/DizoftTeam/jsonrpc_server/tags/)
5+
6+
[![GitHub stars](https://img.shields.io/github/stars/DizoftTeam/jsonrpc_server.svg?style=social&label=Star&maxAge=2592000)](https://GitHub.com/DizoftTeam/jsonrpc_server/stargazers/)
7+
[![GitHub issues](https://img.shields.io/github/issues/DizoftTeam/jsonrpc_server.svg)](https://GitHub.com/DizoftTeam/jsonrpc_server/issues/)
8+
[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://lbesson.mit-license.org/)
9+
[![Open Source? Yes!](https://badgen.net/badge/Open%20Source%20%3F/Yes%21/blue?icon=github)](https://github.com/Naereen/badges/)
10+
11+
Base implementation of JSONRpc v2.0 in Go
412

513
## How to get
614

@@ -25,12 +33,17 @@ import (
2533
"net/http"
2634
)
2735

36+
// UserLogin controller for login method
2837
type UserLogin struct {}
2938

39+
// Handler worker
3040
func (u UserLogin) Handler(params interface{}) (interface{}, *jsonrpc.RPCError) {
31-
// Some logic here.
41+
// Some logic/magic here.
3242
// It's like a controller
3343

44+
// To getting raw request you can run this
45+
// session := jsonrpc.NewSession()
46+
3447
// Success
3548
return "Login ok!", nil
3649

@@ -55,10 +68,10 @@ func main() {
5568

5669
http.HandleFunc("/", jsonrpc.Handler)
5770

58-
fmt.Println()
71+
log.Print("\nStarting server at :8089\n")
5972

60-
if err := http.ListenAndServe("8089", nil); err != nil {
61-
log.Panic("Cant start server", err)
73+
if err := http.ListenAndServe(":8089", nil); err != nil {
74+
log.Panic("Cant start server", err)
6275
}
6376
}
6477
```

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module github.com/DizoftTeam/jsonrpc_server
22

3-
go 1.14
3+
go 1.15
44

55
require github.com/mitchellh/mapstructure v1.3.3

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
github.com/mitchellh/mapstructure v1.3.0 h1:iDwIio/3gk2QtLLEsqU5lInaMzos0hDTz8a6lazSFVw=
2-
github.com/mitchellh/mapstructure v1.3.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
31
github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8h+eeNA8=
42
github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=

0 commit comments

Comments
 (0)