Last active
August 29, 2015 14:17
-
-
Save ar1g/6f40454518649223e5f3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| var http = require('http'), | |
| pool = require('threads_a_gogo').createPool(5).all.eval(fib); | |
| function fib(n) { | |
| return (n < 2) ? 1 : (fib(n-2)+fib(n-1)); | |
| } | |
| var server = http.createServer(function(req, res) { | |
| pool.any.eval('fib('+req.url.replace('/', '')+')', function(err, data) { | |
| res.writeHead(200); | |
| res.end(data+"\n"); | |
| }); | |
| }).listen(8000); | |
| console.log("server online at http://localhost:8000/"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment