Browse files

initial version

  • Loading branch information...
1 parent 4110289 commit 932d6000514bc8de9ddbdb7bffa368a6c8f5defb @chamerling chamerling committed Nov 16, 2012
Showing with 72 additions and 1 deletion.
  1. +3 −0 .gitignore
  2. +11 −1 README.md
  3. +25 −0 app.js
  4. +33 −0 package.json
View
3 .gitignore
@@ -11,4 +11,7 @@ pids
logs
results
+node_modules
npm-debug.log
+
+.idea
View
12 README.md
@@ -1,4 +1,14 @@
play-node-notification
======================
-A notification listener, does nothing but print received ones...
+A notification listener, does nothing but print received ones...
+
+- Install
+
+`npm install`
+
+- run
+
+`node app.js`
+
+Runs on http://localhost:3001, all POST to http://localhost:3001 will print in the console. Get stats at http://localhost:3001/stats
View
25 app.js
@@ -0,0 +1,25 @@
+/**
+ * PLAY Notification
+ *
+ * Copyright(c) 2012 Christophe Hamerling <chamerling@linagora.com>
+ * MIT Licensed
+ */
+
+var express = require('express');
+var app = express();
+var count = 0;
+var port = process.env.PORT || 3001;
+
+app.get('/', function(req, res){
+ res.json({ requests : count} );
+});
+
+app.post('/', function(req, res) {
+ console.log('Got a notification at ', new Date().toGMTString());
+ count++;
+ console.log(req.body)
+});
+
+app.listen(port, function(err) {
+ console.log('Notification listener is waiting messages on http://localhost:' + port + "/");
+});
View
33 package.json
@@ -0,0 +1,33 @@
+{
+ "name": "play-node-notification",
+ "version": "0.0.1",
+ "description": "Receiving WSN stuff",
+ "author": "Christophe Hamerling <christophe.hamerling@linagora.com>",
+ "homepage": "http://github.com/play-project/play-node-notification",
+ "keywords": [
+ "node"
+ ],
+ "maintainers": [{
+ "name": "Christophe Hamerling",
+ "email": "christophe.hamerling@gmail.com"
+ }],
+ "contributors": [],
+ "licenses": [{
+ "type": "MIT",
+ "url": "http://mths.be/mit"
+ }],
+ "bugs": {
+ "url": "https://github.com/play-project/play-node-notification/issues"
+ },
+ "repository": {
+ "type": "git",
+ "url": "http://github.com/play-project/play-node-notification.git"
+ },
+ "engines": {
+ "node": "0.6.x",
+ "npm": "1.0.x"
+ },
+ "dependencies": {
+ "express": "3.0"
+ }
+}

0 comments on commit 932d600

Please sign in to comment.