grapnel-server
Advanced tools
Comparing version
/**** | ||
* Grapnel Server | ||
* https://github.com/EngineeringMode/Grapnel.js | ||
* https://github.com/EngineeringMode/Grapnel.js/tree/server-router | ||
* | ||
* @author Greg Sabia Tucker <greg@artificer.io> | ||
* @link http://artificer.io | ||
* @version 0.1.0 | ||
* @version 0.1.2 | ||
* | ||
@@ -19,6 +19,6 @@ * Released under MIT License. See LICENSE.txt or http://opensource.org/licenses/MIT | ||
this.version = '0.1.0'; | ||
this.version = '0.1.2'; | ||
this.req = {}; | ||
this.res = {}; | ||
// Create HTTP Verbs | ||
// HTTP Verbs | ||
['GET', 'POST', 'PUT', 'DELETE'].forEach(function(verb){ | ||
@@ -25,0 +25,0 @@ self[verb.toLowerCase()] = function(){ |
{ | ||
"name": "grapnel-server", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Node.js Router Framework with Named Parameter & Middleware support", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -203,3 +203,3 @@ Grapnel Server-Side Router Framework for Node.js | ||
##### `get` Adds a listeners and middleware for routes | ||
##### `get`, `post`, `put`, `delete` (HTTP verbs) Adds a listeners and middleware for routes matching its respective HTTP verb | ||
```javascript | ||
@@ -216,2 +216,22 @@ /** | ||
}); | ||
app.post('/store/:category', function(req, res){ | ||
var category = req.params.category; | ||
console.log('POST Product %s', category); | ||
}); | ||
app.put('/store/:category', function(req, res){ | ||
var category = req.params.category, | ||
id = req.params.id; | ||
console.log('PUT Product #%s in %s', id, category); | ||
}); | ||
app.delete('/store/:category/:id', function(req, res){ | ||
var category = req.params.category, | ||
id = req.params.id; | ||
console.log('DELETE Product #%s in %s', id, category); | ||
}); | ||
``` | ||
@@ -218,0 +238,0 @@ |
10584
5.91%284
7.58%