Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Removes errant comment * Update .gitignore with nyc folders
- Loading branch information
Showing
8 changed files
with
122 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
.DS_Store | ||
node_modules/ | ||
reports/ | ||
__pycache__/ | ||
*.pyc | ||
*.pyo | ||
.nyc_output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
var microcule = require('../'); | ||
var express = require('express'); | ||
var app = express(); | ||
|
||
var nodeService = function testService (opts) { | ||
var res = opts.res; | ||
console.log('logging to console'); | ||
res.end('ran service'); | ||
}; | ||
|
||
var handler = microcule.plugins.spawn({ | ||
code: nodeService, | ||
language: "javascript", | ||
jail: "chroot", | ||
jailArgs: [ '/Users/worker'] | ||
}); | ||
|
||
app.use(handler); | ||
|
||
app.listen(3000, function () { | ||
console.log('server started on port 3000'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
var microcule = require('../'); | ||
var express = require('express'); | ||
var app = express(); | ||
|
||
var nodeService = function testService (opts) { | ||
var res = opts.res; | ||
console.log('logging to console'); | ||
setTimeout(function(){ | ||
res.end('ran service'); | ||
}, 10) | ||
}; | ||
|
||
var bash = microcule.plugins.spawn({ | ||
code: 'ps -ax', | ||
language: "bash", | ||
jail: "nsjail", | ||
jailArgs: [ '-Mo', '--chroot', '/var/chroot/', '--user', '99999', '--group', '99999'] | ||
}); | ||
|
||
var handler = microcule.plugins.spawn({ | ||
code: nodeService, | ||
language: "javascript", | ||
jail: "nsjail", | ||
jailArgs: [ '-Mo', '--chroot', '/var/chroot/', '--user', '99999', '--group', '99999'] | ||
}); | ||
|
||
var ps = microcule.plugins.spawn({ | ||
bin: "/bin/ps", | ||
argv: ['-ax' ] | ||
}); | ||
|
||
var psJail = microcule.plugins.spawn({ | ||
bin: "/bin/ps", | ||
argv: ['-ax' ], | ||
jail: "nsjail", | ||
jailArgs: [ '-Mo', '--chroot', '/var/chroot/', '--user', '99999', '--group', '99999'] | ||
}); | ||
|
||
app.use('/node', handler); | ||
app.use('/ps', ps); | ||
app.use('/psjail', psJail); | ||
|
||
app.listen(3000, function () { | ||
console.log('server started on port 3000'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
var microcule = require('../'); | ||
var express = require('express'); | ||
var app = express(); | ||
|
||
var nodeService = function testService (opts) { | ||
var res = opts.res; | ||
console.log('logging to console'); | ||
res.end('Hello world!'); | ||
}; | ||
|
||
var handler = microcule.plugins.spawn({ | ||
code: nodeService, | ||
language: "javascript" | ||
}); | ||
|
||
//var view = microcule.plugins.viewPresenter({}, req, res, next); | ||
|
||
app.use('/view', function(req, res, next){ | ||
microcule.viewPresenter({ | ||
view: "Service outputs: {{hook.output}}" | ||
}, req, res, function(err, req, output){ | ||
handler(req, output, next) | ||
}) | ||
}); | ||
|
||
/* presenter API has been removed ( for now ) | ||
app.use('/view-presenter', function(req, res, next){ | ||
microcule.viewPresenter({ | ||
view: "Service outputs: {{hook.output}} <div class='output'><div>", | ||
presenter: function (opts, cb) { | ||
opts.res.setHeader('Content-type', 'text/html'); | ||
var $ = this.$; | ||
$('.output').html('presenters can use $ selectors'); | ||
cb(null, $.html()); | ||
} | ||
}, req, res, function(err, req, output){ | ||
handler(req, output, next) | ||
}) | ||
}); | ||
*/ | ||
|
||
app.listen(3000, function () { | ||
console.log('server started on port 3000'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = function (hook) { | ||
var req = hook.req, res = hook.res; | ||
res.write('Hello, this is a JavaScript function.\n'); | ||
res.write('hook.params is populated with request parameters\n'); | ||
res.write(JSON.stringify(req.params, true, 2)); | ||
res.end(''); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
print ("hello world") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Collection of invalid / erroring microservices. Useful for testing error conditions, can be put into unit tests. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters