Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created December 14, 2017 02:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcomartin/a99f8ebd2bb8f933fe54ae6b276b8365 to your computer and use it in GitHub Desktop.
Save dcomartin/a99f8ebd2bb8f933fe54ae6b276b8365 to your computer and use it in GitHub Desktop.
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