Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 92 lines (70 sloc) 3.293 kB
c3b700d @DukeyToo Remove commander dependency, since the pull request I need to make th…
DukeyToo authored
1 Package Goal
2 ------------
c8dc8a4 @DukeyToo Update readme.md
DukeyToo authored
3 The goals of this package are to support:
03b4aa8 @DukeyToo Fine-tuning stuff, fleshing out the readme.md
DukeyToo authored
4
c9b1bbe @DukeyToo Updated readme with better feature list
DukeyToo authored
5 - Well-designed APIs (easy to use, scales well, easy to extend, etc)
6 - Simple usage of any API from any programming language. (Its pretty easy already, but we make it even easier)
c8dc8a4 @DukeyToo Update readme.md
DukeyToo authored
7 - Full support for running an API as a service on Linux and Windows operating systems
4b9c6b3 @DukeyToo Bump version
DukeyToo authored
8 - Simplicity of development for both API authors and consumers
c9b1bbe @DukeyToo Updated readme with better feature list
DukeyToo authored
9
b30d3cc @DukeyToo Refine readme.md
DukeyToo authored
10
c9b1bbe @DukeyToo Updated readme with better feature list
DukeyToo authored
11 Reasons to use PerfectAPI (Current Feature list)
b30d3cc @DukeyToo Refine readme.md
DukeyToo authored
12 -------------------------
6fcda91 @DukeyToo git markdown is so frigging sensitive
DukeyToo authored
13
c9b1bbe @DukeyToo Updated readme with better feature list
DukeyToo authored
14 - You want to expose an API using Node.js, or you want to make an existing Node.js module accessible as a remote service API
4b9c6b3 @DukeyToo Bump version
DukeyToo authored
15 - You care about performance - [4 times faster than node-restify](http://blog.perfectapi.com/2012/benchmarking-apis-using-perfectapi-vs-express.js-vs-restify.js/)
c9b1bbe @DukeyToo Updated readme with better feature list
DukeyToo authored
16 - Easily create a self-hosted server with command-line - `myapp server -p 3002`
4b9c6b3 @DukeyToo Bump version
DukeyToo authored
17 - Support for easy configuration via environment variables
c9b1bbe @DukeyToo Updated readme with better feature list
DukeyToo authored
18 - Awesomely amazing test page for your users to learn/experiment/test your API, e.g. [amigen api test page](http://services.perfectapi.com:3000/amigen/testapp/)
c8dc8a4 @DukeyToo Update readme.md
DukeyToo authored
19 - Windows and Linux installers (run your API as a true service on your server) - `myapp install myappservicename`
4b9c6b3 @DukeyToo Bump version
DukeyToo authored
20 - Automatic validation of required parameters (no need to code boring validation)
c9b1bbe @DukeyToo Updated readme with better feature list
DukeyToo authored
21 - Local command-line access to your API
22 - Built-in JSONP interface to your API - that means you can access it using JavaScript from another domain
28d620d @DukeyToo Added basic maxage and etag caching support on GETs
DukeyToo authored
23 - REST-like interface to your API
2c4bc63 @DukeyToo Update readme with c# example, add c# language to testapp page
DukeyToo authored
24 - Native .NET client to your API - access from .NET without dealing with REST, JSON, WebRequest etc.
28d620d @DukeyToo Added basic maxage and etag caching support on GETs
DukeyToo authored
25 - Built-in support for max-age and etag server caching - lowers your costs by doing less work
c9b1bbe @DukeyToo Updated readme with better feature list
DukeyToo authored
26
27 Is it Perfect?
28 --------------
b9233e7 @DukeyToo Working version, needs a lot of refactoring though!
DukeyToo authored
29
c9b1bbe @DukeyToo Updated readme with better feature list
DukeyToo authored
30 No. See the [FAQ](https://github.com/perfectapi/node-perfectapi/wiki/FAQ)
03b4aa8 @DukeyToo Fine-tuning stuff, fleshing out the readme.md
DukeyToo authored
31
32 Install
33 -------
34 The usual for Node.js stuff
81ad811 @DukeyToo Add .npmignore, tweak readme.md
DukeyToo authored
35
36 $ npm install perfectapi
03b4aa8 @DukeyToo Fine-tuning stuff, fleshing out the readme.md
DukeyToo authored
37
b9233e7 @DukeyToo Working version, needs a lot of refactoring though!
DukeyToo authored
38 or for a global install:
2de6e0c @DukeyToo doggam md.
DukeyToo authored
39
b9233e7 @DukeyToo Working version, needs a lot of refactoring though!
DukeyToo authored
40 $ sudo npm install -g perfectapi
03b4aa8 @DukeyToo Fine-tuning stuff, fleshing out the readme.md
DukeyToo authored
41
b30d3cc @DukeyToo Refine readme.md
DukeyToo authored
42 How to include in your API
43 --------------------------
8676846 @DukeyToo Fix wiki link
DukeyToo authored
44 First, create a `perfectapi.json` configuration file. See [Configuration File](node-perfectapi/wiki/perfectapi-config-file-format) for details. Once you have a configuration file, a sample usage is:
2de6e0c @DukeyToo doggam md.
DukeyToo authored
45
46 ```
b9233e7 @DukeyToo Working version, needs a lot of refactoring though!
DukeyToo authored
47 #!/usr/bin/env node
48
49 var perfectapi = require('perfectapi');
03b4aa8 @DukeyToo Fine-tuning stuff, fleshing out the readme.md
DukeyToo authored
50 var path = require('path');
51
b9233e7 @DukeyToo Working version, needs a lot of refactoring though!
DukeyToo authored
52 var configPath = path.resolve(__dirname, 'perfectapi.json');
53 var parser = new perfectapi.Parser();
9a784a5 @DukeyToo Updated readme.md example
DukeyToo authored
54
b30d3cc @DukeyToo Refine readme.md
DukeyToo authored
55 //handle the commands
b9233e7 @DukeyToo Working version, needs a lot of refactoring though!
DukeyToo authored
56 parser.on("mycommand", function(config, callback) {
57 //do mycommand code, putting results into "result" object
9a784a5 @DukeyToo Updated readme.md example
DukeyToo authored
58
b9233e7 @DukeyToo Working version, needs a lot of refactoring though!
DukeyToo authored
59 //after done
60 callback(err, result);
9a784a5 @DukeyToo Updated readme.md example
DukeyToo authored
61 });
b9233e7 @DukeyToo Working version, needs a lot of refactoring though!
DukeyToo authored
62
63 parser.on("anothercommand", function(config, callback) {
64 //do anothercommand code, putting results into "result" object
9a784a5 @DukeyToo Updated readme.md example
DukeyToo authored
65
b9233e7 @DukeyToo Working version, needs a lot of refactoring though!
DukeyToo authored
66 //after done
67 callback(err, result);
9a784a5 @DukeyToo Updated readme.md example
DukeyToo authored
68 });
69
85f66da @DukeyToo Update example in readme.md
DukeyToo authored
70 //expose the api
71 module.exports = parser.parse(configPath);
03b4aa8 @DukeyToo Fine-tuning stuff, fleshing out the readme.md
DukeyToo authored
72 ```
73
b30d3cc @DukeyToo Refine readme.md
DukeyToo authored
74 In your `package.json` file, be sure to specify the above file as a "bin", so that the app can be called from the command-line, e.g.
75
76 ```
c8dc8a4 @DukeyToo Update readme.md
DukeyToo authored
77 { "name": "myNodeLib"
78 , "version": "0.0.1"
79 , "description": "My brilliant API"
80 , "main": "./bin/myNodeLib.js"
81 , "bin": "./bin/myNodeLib.js"
82 , "engines": {
83 "node" : ">=0.6.5"
84 }
85 , "dependencies": {
86 "perfectapi": ">=0.0.13"
87 }
b30d3cc @DukeyToo Refine readme.md
DukeyToo authored
88 }
89 ```
90 Thats it.
91
4b9c6b3 @DukeyToo Bump version
DukeyToo authored
92 See [the website](http://perfectapi.github.com/node-perfectapi) and [wiki](http://github.com/perfectapi/node-perfectapi/wiki) for more info.
Something went wrong with that request. Please try again.