.POST([url], callback) .GET([url], callback) .request(callback) */ var HTTP = require('http') var http = new HTTP f(http.url) f(http.header) f(http.data) f(http.method) f(http.on) f(http.off) f(http.success) f(http.fail) f(http.complete) f(http.POST) f(http.GET) f(http.request) ok(http.on('complete', function () {log('complete')})) ok(http.on(200, function () {log(200)})) ok(http.on('Ok', function () {log('Ok')})) ok(http.on(304, function () {log(304)})) ok(http.on('Not Modified', function () {log('Not Modified')})) ok(http.GET('http://lc:3000/test/http.js', function () {log('done')}))
// performance-budget// require('./performance-budget/performanceBudget')(); // performance-budget// http.listen(website.get('port'), function(){ console.log('Website ready, listening on port: ' + website.get('port')); }); http.on('error', function(err) { console.error(''); console.error(chalk.inverse('SERVER ERROR')) console.error(chalk.inverse('Error code: %s'), err.code); if(err.code === 'EADDRINUSE'){ console.error('>> It looks like port ' + chalk.underline(website.get('port')) + ' is being used by another process. The port can only be used by ' + chalk.underline('one') + ' process.'); } console.error('>> ' + chalk.underline('Full Error'), err); console.error(''); }) module.exports = website; (function () { 'use strict'; module.exports = function(){ var config = require('./project.json');
this;this._logger.log("trace","load device descriptin from url:"+a);var e=c;$.ajax({url:a,type:"get",timeout:5E3,dataType:"text",cache:!0,success:function(a){d._logger.log("trace","http request success:"+a);e&&(e(null,a),e=null)},error:function(a,c){a="http request error:"+(a?a.status:"0")+"-"+c;d._logger.log("trace",a);e&&(e(Error(a)),e=null)}})};b.prototype._loadDeviceDesc2=function(a,c){this._logger.log("trace","load device descriptin from url:"+a);a=require("url").parse(a);a={host:a.hostname, port:a.port,path:a.path,method:"GET"};var d=this,e="",b=require("http"),g=c;try{var h=b.request(a,function(a){a.on("data",function(a){e+=a});a.on("end",function(){if(200==a.statusCode)d._logger.log("trace","http request success:"+e),g&&g(null,e);else{var c="http request error:"+a.statusCode+"-"+e;d._logger.log("trace",c);g&&g(Error(c))}g=null})});h.setTimeout&&h.setTimeout(2E3,function(){h.abort()});if(h.on&&"function"==typeof h.on)h.on("error",function(a){a||(a=Error("http request error"));g&&g(a); g=null});h.end()}catch(k){g&&g(k),g=null}};b.prototype._parseDesc=function(a){-1!=a.indexOf('xmlns:ms=" urn:microsoft-com:wmc-1-0"')&&(a=a.replace('xmlns:ms=" urn:microsoft-com:wmc-1-0"','xmlns:ms="urn:microsoft-com:wmc-1-0"'));var c=null;try{c=$($.parseXML(a))}catch(f){}if(!c)return null;a=c.find("device");if(!a||0==a.length)return null;a=$(a[0]);var d=this._parseDescXml(a);if(!d)return null;d.embeddedDevices=[];var e=this;c.find("deviceList device").each(function(){var a=$(this);(a=e._parseDescXml(a))&&