Tags: Models
Simple service serving a message to the world.
- Install NATS Server and Resgate (done with 3 docker commands).
git clone https://github.com/jirenius/csharp-res
Open the solution, examples\01_HelloWorld\HelloWorld.sln
, in Visual Studio 2017.
Press F5 to build and run the HelloWorld project.
- Open the browser and go to:
http://localhost:8080/api/example/model
- Open Chrome and go to resgate.io - resource viewer.
- Type in the resource ID below, and click View:
example.model
Note
Chrome allows websites to connect to localhost, while other browsers may give a security error.
- Stop the project, and change the
"Hello, World!"
message in Program.cs. - Restart the project and observe how the message is updated in the viewer (see above).
- In the resgate.io - resource viewer, open the DevTools console (Ctrl+Shift+J).
- Type the following command, and press Enter:
client.get("example.model").then(console.log);
Note
The resource viewer app stores the ResClient instance in the global
client
variable, for easy access.