edge
edge copied to clipboard
npm express package doesn't work using edge in c#
public MainWindow()
{
InitializeComponent();
Start().Wait();
}
public static async Task Start()
{
var createHttpServer = Edge.Func(@"
var http = require('http');
var express = require('express');
var ws = require('ws');
return function (port, cb) {
var server = http.createServer(function (req, res) {
res.end('Express:\n'+express+'\n WS:\n'+ws);
}).listen(port, cb);
};
");
await createHttpServer(8080);
//Console.WriteLine(await new WebClient().DownloadStringTaskAsync("http://localhost:8080"));
}
The above code throws 'System.AggregateException', but when I remove the require('express'); and replace it with a string it prints out the ws object and the string just fine.
both express and ws are installed, so I'm not sure why it doesn't work.