我们知道 npm 是很大的库,很多轮子可以用
所以 .net core 替我们封装了一个调用 nodejs 的 service
就叫 node service
我们只要在 server 安装 nodejs
然后就可以写 js, require npm 的 packages
然后通过 .net core 的 service 允许这个 js 然后返回对应的 result.
比如我想解析一个 html, npm 里就有很多轮子可以做这个.
具体实现参考 :
https://www.cnblogs.com/stulzq/p/10535310.html
http://rion.io/2017/08/22/nodeservices-where-javascript-and-net-meet-back-on-the-other-side/
需要注意的时,安装 nodejs 后最好是 restart 一下
然后 nodejs 最好是安装在默认的 c drive
如果路径不对,我们得通过 enviroment variable 去修改,
windows 的话是去 start -> edit environment variables -> 修改掉 PATH