TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: ElectronCGI – Cross Platform .Net Core GUIs with Electron

4 pointsby rdfiabout 6 years ago
ElectronCGI is a library that enables making requests from a NodeJs application that are served by a .Net application.<p>It uses the standard in&#x2F;out streams for communication.<p>To use it install the electron-cgi npm package on you node application and the ElectronCgi.DotNet nuget package on your .Net console app.<p>Here&#x27;s an example:<p>In NodeJs&#x2F;Electron:<p><pre><code> const { ConnectionBuilder } = require(&#x27;electron-cgi&#x27;); const connection = new ConnectionBuilder() .connectTo(&#x27;dotnet&#x27;, &#x27;run&#x27;, &#x27;--project&#x27;, &#x27;DotNetConsoleProjectWithElectronCgiDotNetNugetPackage&#x27;) .build(); connection.onDisconnect = () =&gt; { console.log(&#x27;Lost connection to the .Net process&#x27;); }; connection.send(&#x27;greeting&#x27;, &#x27;John&#x27;, theGreeting =&gt; { console.log(theGreeting); &#x2F;&#x2F; will print &quot;Hello John!&quot; }); connection.close(); </code></pre> And in the .Net Console Application:<p><pre><code> using ElectronCgi.DotNet; &#x2F;&#x2F;... static void Main(string[] args) { var connection = new ConnectionBuilder() .WithLogging() .Build(); &#x2F;&#x2F; expects a request named &quot;greeting&quot; with a string argument and returns a string connection.On&lt;string, string&gt;(&quot;greeting&quot;, name =&gt; { return $&quot;Hello {name}!&quot;; }); &#x2F;&#x2F; wait for incoming requests connection.Listen(); } </code></pre> [Blog post with extra information about ElectronCGI](<a href="https:&#x2F;&#x2F;www.blinkingcaret.com&#x2F;2019&#x2F;02&#x2F;27&#x2F;electron-cgi&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.blinkingcaret.com&#x2F;2019&#x2F;02&#x2F;27&#x2F;electron-cgi&#x2F;</a>)

1 comment

die_fault_userabout 6 years ago
Very interesting - could this be used with another back end other than .net?
评论 #19263205 未加载