Initial state

This commit is contained in:
SteveSandersonMS
2015-11-02 10:30:36 -08:00
parent 0e1fa2e09d
commit f693bd60e3
110 changed files with 6722 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
var path = require('path');
var readline = require('readline');
var invocationPrefix = 'invoke:';
function invocationCallback(errorValue, successValue) {
if (errorValue) {
throw new Error('InputOutputStreamHost doesn\'t support errors. Got error: ' + errorValue.toString());
} else {
var serializedResult = typeof successValue === 'object' ? JSON.stringify(successValue) : successValue;
console.log(serializedResult);
}
}
readline.createInterface({ input: process.stdin }).on('line', function (message) {
if (message && message.substring(0, invocationPrefix.length) === invocationPrefix) {
var invocation = JSON.parse(message.substring(invocationPrefix.length));
var invokedModule = require(path.resolve(process.cwd(), invocation.moduleName));
var func = invocation.exportedFunctionName ? invokedModule[invocation.exportedFunctionName] : invokedModule;
func.apply(null, [invocationCallback].concat(invocation.args));
}
});
console.log('[Microsoft.AspNet.NodeServices:Listening]'); // The .NET app waits for this signal before sending any invocations