Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using Botwin;
using Grains;
using Microsoft.AspNetCore.Http;
using Orleans;
namespace Web
{
public class CounterModule : BotwinModule
{
public CounterModule(IClusterClient clusterClient)
{
Get("/", async (request, response, _) =>
{
var counter = clusterClient.GetGrain<ICounterGrain>("Demo");
var currentCount = await counter.GetCount();
await response.WriteAsync(currentCount.ToString());
});
Post("/", async (request, response, _) =>
{
var counter = clusterClient.GetGrain<ICounterGrain>("Demo");
await counter.Increment(1);
response.StatusCode = 204;
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.