I am planning to see if I can use nodejs in an windows service( C#) project in any ways. I want to build a prototype which describes the usage of nodejs would be beneficial in some way in my project. I don't want to refactor or change the complete working code of my service, but instead i want to use nodejs as a learning gain with usage in my project.
I see most of the talk on net goes about usage of nodejs in some chat applications/ highly I/O operations.
Some inputs about my project which i could think of missing.Our current windows service-
Can anyone suggest me where would nodejs would be helpful in the above ones? If not , why it isn't? Many Thanks In Advance,
This is a pretty open ended question, so I'll try to help with an open ended answer :)
First off - how to run nodejs code inside of a C# service. You probably want to take a look at edgejs: https://github.com/tjanczuk/edge
using System;
using System.Threading.Tasks;
using EdgeJs;
class Program
{
public static async void Start()
{
var func = Edge.Func(@"
return function (data, callback) {
callback(null, 'Node.js welcomes ' + data);
}
");
Console.WriteLine(await func(".NET"));
}
static void Main(string[] args)
{
Task.Run((Action)Start).Wait();
}
}
For logging - check out winston:
https://github.com/winstonjs/winston
And for perf counters, check this out:
https://www.npmjs.com/package/cwinperfcounter
Hopefully some of this helps. Happy Coding!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.