
Show HN: ElectronCGI – Cross Platform .Net Core GUIs with Electron - rdfi
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>)
======
die_fault_user
Very interesting - could this be used with another back end other than .net?

~~~
rdfi
Currently the only implementation available is for .Net through the
ElectronCgi.DotNet nuget package, but there's no reason for this not to work
with other languages/runtimes (it relies on stdin/stdout that is available in
all processes).

Did you have a particular language/runtime in mind?

