Skip to content

Instantly share code, notes, and snippets.

@mk-pmb
Last active September 23, 2016 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mk-pmb/6ffd658e6b1eb8d8ab78f1adae2be5be to your computer and use it in GitHub Desktop.
Save mk-pmb/6ffd658e6b1eb8d8ab78f1adae2be5be to your computer and use it in GitHub Desktop.
meese's LED request
var express = require('express');
var jquery = require('jquery');
-var bodyParser = require('body-parser');
+var collectStream = require('collect-stream');
var app = express();
-app.use(bodyParser.json()); // for parsing application/json
-app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
+
+function receiveLedMatrix(req, res, err, body) {
+ console.log({ 'error?': err, swtiches: body });
+}
+
app.post('/ledsubmit', function(req, res) {
- var data = req.body;
- console.log(data);
+ collectStream(req, receiveLedMatrix.bind(null, req, res));
});
POST /ledsubmit HTTP/1.1
Host: 45.55.213.88:1337
User-Agent: …
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Referer: http://45.55.213.88/ledart/
Content-Length: 64
Origin: http://45.55.213.88
Connection: keep-alive
0000000000000000000000000000000000000000000000000000000000000000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment