Commander API is a simple ASP.NET Core/.NET 10 LTS REST API that executes CRUD (Create, Retrieve, Update and Delete) operations on an MS SQL Server database using Entity Framework Core.
The Commander API stores command line snippets (e.g. dotnet new webapi to create a new ASP.NET Core Web API).
It is a simple but useful tool when you need to find a specific command line quickly.
Each command line will have the following attributes:
-
How to
Description of what the command will do, e.g. Build a .NET project -
Command line
The actual command line snippet, e.g.dotnet build -
Platform
Application or platform domain, e.g. .NET
The API is currently built with:
- .NET 10 LTS
- ASP.NET Core MVC Controllers
- Entity Framework Core 10
- SQL Server / LocalDB
- AutoMapper
- Newtonsoft.Json and JSON Patch support
- Retrieve all commands
- Retrieve a specific command
- Create a new command
- Update command information
- Partially update command information
- Delete an existing command
As with most REST APIs, Commander API follows the standard set of methods to create, retrieve, update, and delete records in the database. Each functionality can be accessed as listed in the table below:
| Verb | URI | Method | Description |
|---|---|---|---|
| GET | /api/commands | Retrieve | Retrieve all command lines |
| GET | /api/commands/{id} | Retrieve | Retrieve a single resource, (by Id) |
| POST | /api/commands | Create | Create a new command line |
| PUT | /api/commands/{id} | Update | Update a single command line by Id |
| PATCH | /api/commands/{id} | Partial update | Partially update a single command line by Id using JSON Patch |
| DELETE | /api/commands/{id} | Delete | Delete a single command line by Id |
- .NET 10 SDK installed;
- Visual Studio Code installed;
- Microsoft SQL Server Local DB installed;
- MS SQL Server - VSCode Extension - installed;
- Entity Framework Core CLI tool installed or available through your .NET tooling.
- Create a project's directory on your computer;
- Clone the repository.
git clone https://github.com/savaladaojr/CommanderAPI- On the directory where you cloned the repository, open a command prompt and execute the command to open Visual Studio Code and load the project folder. You should see something like the screenshot below.
code .- In the Visual Studio Code, open a Terminal and run the command to restore all packages used by the API;
dotnet restore-
Connect on the SQL Server Local DB:
1.1. Create a new database "CommanderDB" or let Entity Framework create it from the migrations;
1.2. Make sure your Windows user has permission to access the database when using the default trusted connection; -
In the VSCode:
2.1. Open the file "appsettings.json" and change the "CommanderConnection" connection string to reflect your environment, if needed;
2.2. Open a new Terminal and run the command to update the database with the project's database migrations.
dotnet ef database update- Then rebuild the application;
dotnet build- Run the API.
dotnet runTo run some tests on the API, I recommend that you download Postman or use a Google Chrome plug-in. You also have another option, Insomnia. Both work well and have a free version.
I'm using Postman! So I have already prepared a file with all requests for the API. You can find this file (Commands API.postman_collection.json) in the repository.
Example of a request to the API:

{
"howTo": "Build the project",
"line": "dotnet build",
"platform": ".NET"
}Read operations return the following fields:
idhowTolineplatform
This project was migrated from ASP.NET Core 3.1 to .NET 10 LTS. The application now uses the modern hosting model in Program.cs; the old Startup.cs file was removed. The default local connection string no longer stores a username or password in the repository.
Additional architecture and requirements details are documented in docs/REQUISITOS_APLICACAO.md.
- Fork it (https://github.com/savaladaojr/CommanderAPI/fork);
- Create your feature branch (e.g.
git checkout -b feature/fooBar); - Commit your changes (e.g.
git commit -am 'Add some fooBar'); - Push to the branch (e.g.
git push origin feature/fooBar); - Create a new Pull Request.

