diff --git a/src/Microsoft.AspNetCore.NodeServices/README.md b/src/Microsoft.AspNetCore.NodeServices/README.md index 8a63dc2..c771cfd 100644 --- a/src/Microsoft.AspNetCore.NodeServices/README.md +++ b/src/Microsoft.AspNetCore.NodeServices/README.md @@ -63,30 +63,12 @@ public void ConfigureServices(IServiceCollection services) } ``` -Now you can receive an instance of `NodeServices` as a constructor parameter to any MVC controller, e.g.: +Now you can receive an instance of `NodeServices` as an action method parameter to any MVC action, and then use it to make calls into Node.js code, e.g.: ```csharp -using Microsoft.AspNetCore.NodeServices; - -public class SomeController : Controller +public async Task MyAction([FromServices] INodeServices nodeServices) { - private INodeServices _nodeServices; - - public SomeController(INodeServices nodeServices) - { - _nodeServices = nodeServices; - } - - // ... your action methods are here ... -} -``` - -Then you can use this instance to make calls into Node.js code, e.g.: - -```csharp -public async Task MyAction() -{ - var result = await _nodeServices.InvokeAsync("./addNumbers", 1, 2); + var result = await nodeServices.InvokeAsync("./addNumbers", 1, 2); return Content("1 + 2 = " + result); } ```