Dotnet 6 example API using MySql
- Visual Studio Code
- .NET 6.0 SDK
dotnet run
dotnet watch run
to rebuild the changes automatically
The API will be running on 7054 port
You should create a configuration file (appsettings.json) with the following info
{
"ConnectionStrings": {
"WebApiDatabase": "server=localhost; database={your-database-name}; user={your-user}; password={your-password}"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
- In some cases you will need to config you database connection data in
appsettings.Development.json
file
export PATH=$PATH:/home/{system-username}/.dotnet
export PATH=$PATH:/home/{system-username}/.dotnet/tools
dotnet tool install --global dotnet-ef
dotnet ef database update
You can check the Swagger API documentation on URL https://localhost:7054/swagger/index.html