Skip to content

hrguedes/boilerplate-net-api

Repository files navigation

Boilerplate .NET API

In progress

Created to be used as a reference for new projects

Stack

Stack

Attention

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

Features

  • CRUD Company
  • Redis Integration
  • MassTransit for MessageQueue
  • MongoDB Repository
  • Versioning API
  • Autentication (pt-BR)

Roadmap

  • Finish CRUD Company
    • Create
      • Test - OK
    • Read
      • Test - OK
    • Update
      • Test - OK
    • Remove
      • Test - OK
    • List All
  • Alter class MassTransit to Generic class
  • Create Filter and Pagination

Project Structure

Running

Pre requisites

  • 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

API Reference

Version: v1

Contact information:
Hugo Guedes
https://github.com/hrguedes/boilerplate-net-api
hugo.guedes@hrguedes.dev

/api/v1/Company/add

POST

Summary:

Add new Company

Description:

POST /api/v1/Company/add

Responses
Code Description
200 Company Created
400 Client Error
500 Server Error (Contact Admin)

Authors

References

About

Created to be used as a reference for new projects

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages