Microapp to connect Lit and node with jrpc-oo. This is a microapp starter.
npm install @flatmax/lit-jrpc-nodeThis infrastructure can be easily cloned and updated for your own microapp which allows you to call objects using JRPC2 over the network between browsers, node or both.
web-dev-serverWe will use secure websockets (although you don't have to), so first generate the certificate :
``bash`
./jrpc-node.genCert.sh
Install the requirements :
`bash`
npm i
Start the nodejs JRPC-OO side :
``
./jrpc-node.js
Start the web dev server :
`bash`
npm start
If the browser doesn't open to the demo, manually copy the url from the command line to the browser.
Note : for the first time, look at the console, as you have to clear the browser to use the private cert in this example due to the browser's "privacy error".
We will clone and take ownership of the webcomponent and node class. We will use vanilla in place of lit.
* First clone the repo : `git clone https://github.com/flatmax/lit-jrpc-node.git``
* Rename the repo : mv lit-jrpc-node vanilla-jrpc-node``
Steps to create your own web component :
* Choose a name for your component : I will choose VanillaJRPC (vanilla-jrpc)
* Rename some files in the repo :
* mv lit-jrpc.js vanilla-jrpc.js
* mv src/LitJRPC.js src/VanillaJRPC.js
* Find and replace the component name :
* Replace "LitJRPC" for "VanillaJRPC"
* Replace "lit-jrpc" for "vanilla-jrpc"
* Choose a name for your class : I will choose VanillaNode
* Rename the class file :
* mv TestClass.js VanillaNode.js
* Find and replace the class name :
* Replace "TestClass" for "VanillaNode"