Created to be used as a reference for new projects
This project is organized using SOLID and DDD principles (of course it does not meet all the principles).
if you are going to use it, read the code and see if it fits
- CRUD Company
- Redis Integration
- MassTransit for MessageQueue
- MongoDB Repository
- Versioning API
- Autentication (pt-BR)
- Finish CRUD Company
- Create
- Test - OK
- Read
- Test - OK
- Update
- Test - OK
- Remove
- Test - OK
- List All
- Create
- Alter class MassTransit to Generic class
- Create Filter and Pagination
- Visual Studio or Rider*
- Mongo DB*
- .NET Core 7*
- Redis
- RabbitMQ, SQS, Azure Service Bus
Open project in Visual studio or Rider, if necessary run to restore packages
dotnet restore
configure file lauchsettings.json
in src/presentation/Api/Properties/lauchsettings.json
"environmentVariables": {
"MONGO_CONNECTION_STRING": "mongodb://developer:%40Developer@192.168.0.1/?authMechanism=SCRAM-SHA-1&authSource=admin",
"REDIS_CONNECTION_STRING": "localhost:8080",
"ASPNETCORE_ENVIRONMENT": "Development"
}
after this configure Constants in src/shared/Consts/LaunchSettings.cs
public static class LaunchSettings
{
#region Mongo DB
public static string ConnectionString = Environment.GetEnvironmentVariable("MONGO_CONNECTION_STRING") ?? "SET_HERE_LOCAL_DEVELOPMENT";
public static string Database = "BOILERPLATEPROJECT";
#endregion
#region Redis
public static string RedisConnectionString = Environment.GetEnvironmentVariable("REDIS_CONNECTION_STRING") ?? "SET_HERE_LOCAL_DEVELOPMENT";
public static string[] RedisDatabases = {"BOILERPLATEPROJECT"};
public static double KeepAlive = 10;
public static double ResponseTimeout = 10;
public static double ConnectTimeout = 10;
public static string KeyPrefix = "KEY_BOILERPLATE";
#endregion
}
and running project in src/presentation/Api/Api.csproj
with command
dotnet run
Default URL: http://localhost:5274/swagger/index.html
Contact information:
Hugo Guedes
https://github.com/hrguedes/boilerplate-net-api
hugo.guedes@hrguedes.dev
Add new Company
POST /api/v1/Company/add
Code | Description |
---|---|
200 | Company Created |
400 | Client Error |
500 | Server Error (Contact Admin) |