UNPKG

nko2013-raspinodeos-server

Version:

Sample service to be run by NodeOS

27 lines (18 loc) 836 B
// SUCH SERVER var http = require('http'); var bark = 80 ; var megawoof = '<?xml version="1.0" encoding="UTF-8"?>\n' ; megawoof = megawoof + '<json:object xsi:schemaLocation="http://www.datapower.com/schemas/json jsonx.xsd"\n' megawoof = megawoof + ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\n' megawoof = megawoof + ' xmlns:json="http://www.ibm.com/xmlns/prod/2009/jsonx">\n' megawoof = megawoof + ' <json:string name="status">wow so source</json:string>\n' megawoof = megawoof + '</json:object>\n' function doge (amaze, woof) { woof.writeHead(200, 'wow', {'Content-Type': 'application/xml'}); woof.end(megawoof); } var shibe = http.createServer(doge); function headcock () { console.log('wow\n so server on port %s\n\n such amaze', bark); } shibe.listen(bark, headcock);