Skip to content

Commit

Permalink
Add the build status
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Aug 14, 2014
1 parent c360087 commit a42c31c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
5 changes: 4 additions & 1 deletion README.md
@@ -1,6 +1,9 @@

[![Build Status](https://api.travis-ci.org/gmszone/iot-coap.png)](https://travis-ci.org/gmszone/iot-coap)

#物联网系统 CoAP版

这是一个开源的最小物联网系统的CoAP版,如果你还是一个初学者建议用HTTP版 [https://github.com/gmszone/iot-coap][iot]
这是一个开源的最小物联网系统的CoAP版,如果你还是一个初学者建议用HTTP版 [https://github.com/gmszone/iot][iot]

##依赖库

Expand Down
16 changes: 11 additions & 5 deletions server/server.js
Expand Up @@ -22,17 +22,23 @@ function start_server() {
});

db.close();

var coap = require('coap');
var server = coap.createServer();
var server = coap.createServer({});

server.on('request', function(req, res) {
if (req.headers['GET'] !== 0){
console.log(req);
if (req.headers['GET'] !== 0) {
res.end('GET ' + req.url.split('/')[1] + '\n');
res.code = '4.06';
} else {
res.end('Hello ' + req.url.split('/')[1] + '\n');
}
};

res.setOption('Content-Format', 'application/json');

res.end(JSON.stringify({
hello: "world"
}));
});

server.listen(function() {
Expand Down

0 comments on commit a42c31c

Please sign in to comment.