Skip to content

Commit

Permalink
Docs and relicense
Browse files Browse the repository at this point in the history
  • Loading branch information
IonicaBizau committed Jul 7, 2015
1 parent b55f3c1 commit 9654922
Show file tree
Hide file tree
Showing 5 changed files with 145 additions and 88 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
*.swo
*~
*.log
node_modules
node_modules
61 changes: 61 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# :eight_spoked_asterisk: :stars: :sparkles: :dizzy: :star2: :star2: :sparkles: :dizzy: :star2: :star2: Contributing :star: :star2: :dizzy: :sparkles: :star: :star2: :dizzy: :sparkles: :stars: :eight_spoked_asterisk:

So, you want to contribute to this project! That's awesome. However, before
doing so, please read the following simple steps how to contribute. This will
make the life easier and will avoid wasting time on things which are not
requested. :sparkles:

## Discuss the changes before doing them
- First of all, open an issue in the repository, using the [bug tracker][1]
describing the contribution you'd like to make, the bug you found or any
other ideas you have. This will help us to get you started on the right
foot.

- If it makes sense, add the platform and software information (e.g. operating
system, Node.JS version etc), screenshots (so we can see what you're seeing).

- It's recommended to wait for feedback before continuing to next steps. However,
if the issue is clear (e.g. a typo) and the fix is simple, you can continue
and fix it.

## Fixing issues
- Fork the project in your account and create a branch with your fix:
`some-great-feature` or `some-issue-fix`.

- Commit your changes in that branch, writing the code following the
[code style][2]. If the project contains tests (generally, the `test`
directory), you are encouraged to add a test as well. :memo:

- If the project contains a `package.json` file add yourself in the
`contributors` array (if it doesn't exist, create it):

```json
{
"contributors": [
"Your Name <and@email.address> (http://your.website)
]
}
```

## Creating a pull request

- Open a pull request, and reference the initial issue in the pull request
message (e.g. *fixes #<your-issue-number*). Write a good description and
title, so everybody will know what is fixed/improved.

- If it makes sense, add screenshots, gifs etc, so it's easier to see what's
going on.

## Wait for feedback
Before accepting your contributions, we will review them. You may get feedback
about what should be fixed in your modified code. If so, just keep committing
in your branch and the pull request will be updated automatically.

## Everyone is happy!
Finally, your contributions will be merged, and everyone will be happy! :smile:

Thanks! :sweat_smile:

[1]: https://github.com/IonicaBizau/node-jsonrequest/issues

[2]: https://github.com/IonicaBizau/code-style
37 changes: 20 additions & 17 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
The MIT License (MIT)
The KINDLY License
Copyright (c) 2015 Ionică Bizău <bizauionica@gmail.com>

Copyright (c) 2014-15 Ionică Bizău
You have the permission to use this software, read its source code, modify and
redistribute it under the following terms:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
- if you want to use this software or include parts of its code in a
closed-source or commercial project you should kindly ask the
author (via a private message or email) and get a positive answer
- this license should be included in the modified versions of this software
- in case of redistributing modified copies, you are encouraged to clearly
indicate that the copies are based on this work
- if you think that your redistributed copy is awesome, you are encouraged to
show the author of this software what you did and how you helped the others

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
You are free to install and use this software on as many machines as you want,
free of charge, making sure you met the terms above.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
You are encouraged to kindly support the software and its author by:

- sharing his/her work
- reporting issues/bugs and asking for feature requests
- donating money or any other things that can help the author
- contribute on the software code by fixing bugs and adding features
81 changes: 49 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,53 @@
![](http://i.imgur.com/Mt5qcZ5.png)
<!---------------------------------------------------------------------------->
<!-- STOP, LOOK & LISTEN! -->
<!-- ==================== -->
<!-- Do NOT edit this file directly since it's generated from a template -->
<!-- file, using https://github.com/IonicaBizau/node-blah -->
<!-- -->
<!-- If you found a typo in documentation, fix it in the source files -->
<!-- (`lib/*.js`) and make a pull request. -->
<!-- -->
<!-- If you have any other ideas, open an issue. -->
<!-- -->
<!-- Please consider reading the contribution steps (CONTRIBUTING.md). -->
<!-- * * * Thanks! * * * -->
<!---------------------------------------------------------------------------->

# jsonrequest [![Donate now][donate-now]][paypal-donations]

jsonrequest
===========
A tiny library for requesting and getting JSON resources.

# Installation
## Installation

```sh
$ npm install jsonrequest
$ npm i jsonrequest
```

# Example
## Example

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

// GET request
JsonRequest("http://localhost:9000/", function (err, data) {
// Make a request to GitHub API
JsonRequest("https://api.github.com/users/IonicaBizau", function (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",
// ...
// }

// POST request
JsonRequest({
url: "http://localhost:9000/hello"
, method: "POST"
, data: {
"some": "data"
}
}, function (err, data) {
console.log(err || data);
});
```

# Documentation
## Documentation

### `JsonRequest(options, data, callback)`
Creates the http(s) request and parses the response.

Expand All @@ -43,15 +59,16 @@ Creates the http(s) request and parses the response.
#### Return
- **Object** The request object.

# How to contribute
1. File an issue in the repository, using the bug tracker, describing the
contribution you'd like to make. This will help us to get you started on the
right foot.
2. Fork the project in your account and create a new branch:
`your-great-feature`.
3. Commit your changes in that branch.
4. Open a pull request, and reference the initial issue in the pull request
message.

# License
See the [LICENSE](./LICENSE) file.
## How to contribute
Have an idea? Found a bug? See [how to contribute][contributing].

## License
[KINDLY][license] © [Ionică Bizău][website]–The [LICENSE](/LICENSE) file contains
a copy of the license.

[license]: http://ionicabizau.github.io/kindly-license/?author=Ionic%C4%83%20Biz%C4%83u%20%3Cbizauionica@gmail.com%3E&year=2015
[contributing]: /CONTRIBUTING.md
[website]: http://ionicabizau.net
[docs]: /DOCUMENTATION.md
[paypal-donations]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MG98D7NPFZ3MG
[donate-now]: http://i.imgur.com/jioicaN.png
52 changes: 14 additions & 38 deletions example/index.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,17 @@
// Dependencies
var JsonRequest = require("../lib")
, Lien = require("lien")
;
var JsonRequest = require("../lib");

// Init lien server
var server = new Lien({
host: "localhost"
, port: 9000
});

// Handle "/"
server.page.add(/^\/$/, function (lien) {
lien.end({
Hello: "World"
});
})

// Handle "/hello"
server.page.add(/^\/hello$/, function (lien) {
lien.end({
method: lien.method
, data: lien.data
});
});

server.on("load", function (err) {
if (err) { throw err; }
JsonRequest("http://localhost:9000/", function (err, data) {
console.log(err || data);
JsonRequest("http://localhost:9000/hello", {
"some": "data"
}, function (err, data) {
console.log(err || data);
JsonRequest("https://status.github.com/api.json", function (err, data) {
console.log(err || data);
process.exit(0);
})
});
});
// Make a request to GitHub API
JsonRequest("https://api.github.com/users/IonicaBizau", function (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",
// ...
// }

0 comments on commit 9654922

Please sign in to comment.