Thinking of the project–part 2
WebAPI2CLI
This is a part of the series where about how I made the WebAPI2CLI - Execute ASP.NET Core WebAPI from Command LineSource code on https://github.com/ignatandrei/webAPI2CLI/
The questions that I have to solve is :
1. How to run something in an ASP.NET Core project, when we have just WEBAPI controllers ?
The answer was pretty simple: Hosted Services: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/host/hosted-services?view=aspnetcore-3.1&tabs=visual-studio . It runs unattended and can be started by the project
2. Which version of .NET Core should I use ?
Another simple answer, looking at https://dotnet.microsoft.com/platform/support/policy/dotnet-core – the only one that has LTS now is .NET Core 3.1 . Although, if someone requires , I can do a .NET Core 2.1
3. How can I serialize the HTTP arguments to send to the commands?
There are 2 means of a program to read arguments: by Command Line arguments and by file on disk.
Now, let’s see how many options we have to configure a HTTP call : Verb, Arguments, ContentType, URL, Headers…. hard to fit into a command line. Not mentions that I want to have the option to run many HTTP calls / commands . So , as usual , it will be a mix: comand line for activating the file with the commands.
4. What do I do with the result of HTTP calls ?
The output of the commands will be written to the console. It is the easy way – and you can redirect this output to a file to persist.
5. Where do I store the sources ?
Easy – GitHub – https://github.com/ignatandrei/WebAPI2CLI/
6. How do I find the the project works ?
Azure DevOps to the rescue – it can build the project and run tests. And it is free for Github
7. Where and how I deploy it ?
Where : easy – it will be hosted on NuGet https://www.nuget.org/packages/ExtensionNetCore3
How –easy -Azure DevOps again. https://dev.azure.com/ignatandrei0674/WebAPI2CLI/_build?definitionId=7&_a=summary
8. Where and how I can make the help for this project ?
Again –easy – GitHub has docs – https://ignatandrei.github.io/WebAPI2CLI/
Now let’s do the implementation!
Leave a Reply