From 9654922f365edb301adf2403e866e4a78101170e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Tue, 7 Jul 2015 07:27:31 +0300 Subject: [PATCH] Docs and relicense --- .gitignore | 2 +- CONTRIBUTING.md | 61 ++++++++++++++++++++++++++++++++++++ LICENSE | 37 ++++++++++++---------- README.md | 81 +++++++++++++++++++++++++++++------------------- example/index.js | 52 +++++++++---------------------- 5 files changed, 145 insertions(+), 88 deletions(-) create mode 100644 CONTRIBUTING.md diff --git a/.gitignore b/.gitignore index a931981..61f2900 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ *.swo *~ *.log -node_modules \ No newline at end of file +node_modules diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..4099bdd --- /dev/null +++ b/CONTRIBUTING.md @@ -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 (http://your.website) + ] + } + ``` + +## Creating a pull request + + - Open a pull request, and reference the initial issue in the pull request + message (e.g. *fixes # -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 diff --git a/README.md b/README.md index 5b9890c..b4997ed 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,53 @@ -![](http://i.imgur.com/Mt5qcZ5.png) + + + + + + + + + + + + + + + +# 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. @@ -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 \ No newline at end of file diff --git a/example/index.js b/example/index.js index 1a4aef8..a7bd355 100644 --- a/example/index.js +++ b/example/index.js @@ -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", +// ... +// }