edge
edge copied to clipboard
"How to: use Node.js built-in modules" example does not work using version 5.9.1
I tried to execute the "How to: use Node.js built-in modules" of the Readme.md page. It did not work with the version 5.9.1 of edge.js.
class Program
{
public static async Task Start()
{
var createHttpServer = Edge.Func(@"
var http = require('http');
return function (port, cb) {
var server = http.createServer(function (req, res) {
res.end('Hello, world! ' + new Date());
});
server.listen(port, function(error) {
cb(error, 'hello');
});
};");
object o = await createHttpServer(9999);
Console.WriteLine(o);
Console.ReadKey();
//Console.WriteLine(await new WebClient().DownloadStringTaskAsync("http://localhost:9999"));
}
static void Main(string[] args)
{
Start().Wait();
}
}
The callback was never called I belief, so the await never returned. The same code worked fine when I used the version 4.4.1 of edge.js. This might also be a bug of node.js itself(?)