qcobjects-cli
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -67,3 +67,6 @@ /** | ||
console.log('') | ||
console.log('To start your app in a local server '); | ||
console.log('Execute the command: '); | ||
console.log('> qcobjects launch <appname>'); | ||
console.log('') | ||
process.exit(0); | ||
@@ -230,2 +233,4 @@ }); | ||
exec("qcobjects-server",(err,stdout,stderr)=>{ | ||
}).stdout.on('data', function(data) { | ||
console.log(data); | ||
}); | ||
@@ -232,0 +237,0 @@ },5000); |
@@ -148,2 +148,13 @@ /** | ||
scriptname:'', | ||
showIPAddress:function (){ | ||
var _ret_ = ''; | ||
var os = require('os'); | ||
var ifaces = os.networkInterfaces(); | ||
Object.keys(ifaces).forEach(function (iface){ | ||
ifaces[iface].map(function (ipGroup){ | ||
_ret_ += iface +': ' + PipeLog.pipe(ipGroup)+'\n'; | ||
}); | ||
}); | ||
return _ret_; | ||
}, | ||
start:function (){ | ||
@@ -165,2 +176,10 @@ var server = this.server; | ||
_new_:function (){ | ||
const welcometo = 'Welcome to \n'; | ||
const instructions = 'HTTP2Server \n'; | ||
const logo = ' .d88888b. .d8888b. .d88888b. 888 d8b 888 \r\nd88P\" \"Y88bd88P Y88bd88P\" \"Y88b888 Y8P 888 \r\n888 888888 888888 888888 888 \r\n888 888888 888 88888888b. 8888 .d88b. .d8888b888888.d8888b \r\n888 888888 888 888888 \"88b \"888d8P Y8bd88P\" 888 88K \r\n888 Y8b 888888 888888 888888 888 88888888888888 888 \"Y8888b. \r\nY88b.Y8b88PY88b d88PY88b. .d88P888 d88P 888Y8b. Y88b. Y88b. X88 \r\n \"Y888888\" \"Y8888P\" \"Y88888P\" 88888P\" 888 \"Y8888 \"Y8888P \"Y888 88888P\' \r\n Y8b 888 \r\n d88P \r\n 888P\" '; | ||
console.log(welcometo); | ||
console.log(logo); | ||
console.log(instructions); | ||
logger.info(this.showIPAddress()); | ||
this.server = http2.createSecureServer({ | ||
@@ -183,8 +202,11 @@ key: fs.readFileSync(CONFIG.get('private-key-pem')), | ||
server.on('stream', (stream, headers, flags) => { | ||
stream.session.altsvc('h2=":8000"', stream.id); | ||
stream.session.altsvc('https=":443"', stream.id); | ||
this.request = Object.assign(New(HTTP2ServerRequest),require('url').parse(headers[':path'])); | ||
let request = Object.assign(New(HTTP2ServerRequest),require('url').parse(headers[':path'])); | ||
this.request = request; | ||
this.request.method = headers[':method']; | ||
this.request.path = headers[':path']; | ||
if (this.request.pathname.indexOf('.')<0){ | ||
@@ -199,8 +221,33 @@ this.request.scriptname = CONFIG.get('documentRootFileIndex'); | ||
// ... | ||
if (global.get('backendAvailable')){ | ||
logger.info('Backend Microservices Available'); | ||
let routes = CONFIG.get('backend').routes; | ||
let selectedRoute = routes.filter(route=>{return route.path==request.path}); | ||
if (selectedRoute.length>0){ | ||
selectedRoute.map(route=>{ | ||
Import (route.microservice); | ||
let response = New(Microservice,{ | ||
route:route, | ||
request:request, | ||
stream:stream, | ||
request:request | ||
}); | ||
}); | ||
} else { | ||
this.response = New(HTTP2ServerResponse,{ | ||
stream:stream, | ||
request:this.request | ||
}); | ||
} | ||
this.response = New(HTTP2ServerResponse,{ | ||
stream:stream, | ||
request:this.request | ||
}); | ||
} else { | ||
// ... | ||
this.response = New(HTTP2ServerResponse,{ | ||
stream:stream, | ||
request:this.request | ||
}); | ||
} | ||
}); | ||
@@ -207,0 +254,0 @@ |
{ | ||
"name": "qcobjects-cli", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "qcobjects cli command line tool", | ||
@@ -13,3 +13,3 @@ "main": "qcobjects-cli.js", | ||
"mime": "^2.4.4", | ||
"qcobjects": "^2.1.152" | ||
"qcobjects": "^2.1.156" | ||
}, | ||
@@ -16,0 +16,0 @@ "repository": { |
@@ -27,2 +27,5 @@ #!/usr/bin/env node | ||
} | ||
if (typeof CONFIG.get('backend') != 'undefined'){ | ||
global.set('backendAvailable',true); | ||
} | ||
}catch (e){ | ||
@@ -29,0 +32,0 @@ logger.debug('No config.json file in your project'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41513
868
Updatedqcobjects@^2.1.156