-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 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,53 @@ | ||
# Remote [![Build Status](https://travis-ci.org/sirupsen/logrus.svg?branch=master)](https://201r.com) | ||
|
||
Remote is a structure pawerfull Golang http api that allow us to make some request on avery api or an URL | ||
if you want a well organized code, you'll love remote. | ||
|
||
## Installation | ||
|
||
To install remote package, you need to install Go and set your Go workspace first. | ||
|
||
1. The first need [Go](https://golang.org/) installed (**version 1.12+ is required**), then you can use the below Go command to install Gin. | ||
|
||
```sh | ||
$ go get -u github.com/201RichK/remote | ||
``` | ||
|
||
2. Import it in your code: | ||
|
||
```go | ||
import "github.com/201RichK/remote" | ||
``` | ||
3. Quick start | ||
|
||
```sh | ||
# assume the following codes in example.go file | ||
$ cat example.go | ||
``` | ||
|
||
```go | ||
package main | ||
|
||
import ( | ||
"github.com/201RichK/remote" | ||
"fmt" | ||
) | ||
|
||
func main() { | ||
//Create new config | ||
client := remote.NewRemote(remote.Config{}) | ||
|
||
res, err := client.GET(remote.Options{ | ||
URL: "https://google.com", | ||
}) | ||
|
||
if err != nil { | ||
fmt.Println(err) | ||
} | ||
|
||
if err := json.NewDecoder(os.Stdout).Decode(res.Body); err != nil { | ||
fmt.Println(err) | ||
} | ||
|
||
} | ||
``` |