circle
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -19,2 +19,3 @@ var http = require('http'); | ||
return { | ||
server: server, | ||
start: start, | ||
@@ -49,3 +50,5 @@ format: newFormat | ||
debug('Running at http://%s:%d/', hostname, port); | ||
return http.createServer(onRequest).listen(port, hostname); | ||
return !hostname ? | ||
server.listen(port) : | ||
server.listen(port, hostname); | ||
}; | ||
@@ -52,0 +55,0 @@ |
{ | ||
"name": "circle", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Minimalistic JSON API Server", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,2 +0,2 @@ | ||
## circle | ||
## circle [![Build Status](https://travis-ci.org/azer/circle.png)](https://travis-ci.org/azer/circle) | ||
@@ -83,6 +83,7 @@ Minimalistic NodeJS API Server. | ||
```js | ||
api.format('/person/:name/:surname', 'text/plain', function (response) { | ||
if (response.error) return 'Error: ' + response.error; | ||
return 'Name: ' + response.result.name + ' Surname: ' + response.result.surname + ' E-Mail: ' + response.result.email; | ||
api.format('/person/:name/:surname', 'text/plain', function (context, match) { | ||
return { | ||
contentType: 'text/plain', | ||
response: 'Name: ' + context.result.name + ' Surname: ' + context.result.surname | ||
}; | ||
}); | ||
@@ -89,0 +90,0 @@ ``` |
5853
7
109
98