Created
December 14, 2017 02:23
-
-
Save dcomartin/a99f8ebd2bb8f933fe54ae6b276b8365 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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