Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

removed postdata handling

  • Loading branch information...
commit 30f25569aeebd1004586b5180278fa4e81ef84c6 1 parent b767a6e
@kadirpekel authored
View
36 examples/twinkler/app.js
@@ -1,25 +1,29 @@
var meryl = require('../../index'),
- connect = require('connect'),
- qs = require('querystring');
+ connect = require('connect');
-var twinkles = ['This is my freaking first wink', 'Hey tweeting sucks, lets twinkle'];
+var twinkles = [
+ 'This is my first wink',
+ 'Lets twinkle for a second'
+];
-meryl.p(connect.static(__dirname + '/public'));
-meryl.p(connect.bodyParser());
+meryl
-meryl.h('GET /', function (req, resp) {
- resp.render('index', {twinkles: twinkles});
-});
+ .plug(
+ connect.logger(),
+ connect.static(__dirname + '/public'),
+ connect.bodyParser()
+ )
-meryl.h('POST /newwink', function (req, resp) {
- var postdataAsObject = qs.parse(req.postdata.toString());
- if (postdataAsObject && postdataAsObject.wink) {
- twinkles.push(postdataAsObject.wink);
- }
- resp.redirect('/');
-});
+ .get('/', function (req, resp) {
+ resp.render('index', {twinkles: twinkles});
+ })
-meryl.run({templateDir: 'views'});
+ .post('/newwink', function (req, resp) {
+ twinkles.push(req.body.wink);
+ resp.redirect('/');
+ })
+
+ .run({templateDir: 'views'});
console.log('listening...');
View
2  examples/twinkler/views/index.jshtml
@@ -9,7 +9,7 @@
</ul>
<form action="/newwink" method="post">
- <textarea name="wink" rows="3" colums="20" max-length="140" wrap="soft"></textarea>
+ <input name="wink"max-length="140"></input>
<input type="submit" value="wink" />
</form>
<%= render('footer') %>
View
10 lib/meryl.js
@@ -336,15 +336,7 @@ Meryl.prototype = {
req.meryl = resp.meryl = self;
resp.request = req;
req.params = url.parse(req.url, true);
- req.addListener('data', function (data) {
- if (!req.postdata) {
- req.postdata = data;
- } else {
- req.postdata += data;
- }
- }).addListener('end', function () {
- self._proc(infra, self, req, resp);
- });
+ self._proc(infra, self, req, resp);
};
}
};
View
4 package.json
@@ -1,11 +1,11 @@
{ "readme": "http://github.com/coffeemate/meryl#readme"
-, "version": "1.0.1"
+, "version": "1.0.2"
, "description": "Minimalist web framework for NodeJS"
, "main": "index"
, "author": "Kadir Pekel <kadirpekel@gmail.com>"
, "name": "meryl"
, "bin": {"meryl": "./lib/cli.js"}
-, "engines": { "node": ">=0.4.0" }
+, "engines": { "node": ">=0.6.19" }
, "repository" :
{
"type": "git"
Please sign in to comment.
Something went wrong with that request. Please try again.