Skip to content

Commit

Permalink
Updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
IonicaBizau committed Aug 7, 2017
1 parent 0a3eaa9 commit ae07e03
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
*~
*.log
node_modules
*.env
1 change: 1 addition & 0 deletions DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ You can see below the API reference of this module.
Creates the http(s) request and parses the response.

#### Params

- **String|Object** `options`: A string representing the request url or an object passed to the `tinyreq` function.
- **Object** `data`: The request data object.
- **Function** `callback`: The callback function.
Expand Down
41 changes: 28 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- Please do not edit this file. Edit the `blah` field in the `package.json` instead. If in doubt, open an issue. -->

# jsonrequest

Expand All @@ -18,31 +19,44 @@ $ npm i --save jsonrequest

```js
// Dependencies
var request = require("jsonrequest");
const request = require("jsonrequest");

request({
url: "https://api.github.com/users/IonicaBizau",
headers: {
"User-Agent": "JsonRequest"
}
}).then(data => {
console.log(data);
// => {
// "login": "IonicaBizau",
// "id": 2864371,
// "avatar_url": "https://avatars.githubusercontent.com/u/2864371?v=3",
// "gravatar_id": "",
// "url": "https://api.github.com/users/IonicaBizau",
// "html_url": "https://github.com/IonicaBizau",
// "followers_url": "https://api.github.com/users/IonicaBizau/followers",
// ...
// }
}).catch(err => {
console.error(err);
});

// Make a request to GitHub API
request("https://api.github.com/users/IonicaBizau", function (err, data) {
request("https://ionicabizau.net/api/articles", (err, data) => {
console.log(err || data);
});
// => {
// "login": "IonicaBizau",
// "id": 2864371,
// "avatar_url": "https://avatars.githubusercontent.com/u/2864371?v=3",
// "gravatar_id": "",
// "url": "https://api.github.com/users/IonicaBizau",
// "html_url": "https://github.com/IonicaBizau",
// "followers_url": "https://api.github.com/users/IonicaBizau/followers",
// ...
// }
```



## :question: Get Help

There are few ways to get help:

1. Please [post questions on Stack Overflow](https://stackoverflow.com/questions/ask). You can open issues with questions, as long you add a link to your Stack Overflow question.
2. For bug reports and feature requests, open issues. :bug:
3. For direct and quick help from me, you can [use Codementor](https://www.codementor.io/johnnyb). :rocket:
3. For direct and quick help, you can [use Codementor](https://www.codementor.io/johnnyb). :rocket:


## :memo: Documentation
Expand All @@ -52,6 +66,7 @@ There are few ways to get help:
Creates the http(s) request and parses the response.

#### Params

- **String|Object** `options`: A string representing the request url or an object passed to the `tinyreq` function.
- **Object** `data`: The request data object.
- **Function** `callback`: The callback function.
Expand Down

0 comments on commit ae07e03

Please sign in to comment.