Nancy Scaffolding with log, serializer, all structure to work good for me :D


Keywords
api, base, etc, log, module, nancy, scaffolding, structure, utilities, web, dotnet-core, dotnet-core2, nancy-scaffolding, nuget
License
MIT
Install
Install-Package Nancy.Scaffolding -Version 1.3.3-preview.2

Documentation

Build Status NuGet Downloads NuGet Version Quality Gate Status Coverage

Nancy.Scaffolding

Build web api fast and easily.

Startup Application

Configure service in statup

// Program.cs

class Program
{
    static void Main(string[] args)
    {
        var config = new ApiBasicConfiguration
        {
            ApplicationContainer = RegisterApplicationContainer,
            RequestContainer = RegisterRequestContainer,
            Pipelines = ConfigurePipelines,
            Mapper = ConfigureMapper,
            ConfigureHealthcheck = ConfigureHealthcheck,
            ApiName = "My App",
            ApiPort = 5855,
            EnvironmentVariablesPrefix = "Prefix_"
        };

        Api.Run(config);
    }

    public static List<IHealthcheck> ConfigureHealthcheck(TinyIoCContainer container)
    {
        var hcs = new List<IHealthcheck>();

        return hcs;
    }

    public static TinyIoCContainer RegisterApplicationContainer(TinyIoCContainer container)
    {
        return container;
    }

    public static TinyIoCContainer RegisterRequestContainer(NancyContext context, TinyIoCContainer container)
    {
        return container;
    }

    public static IPipelines ConfigurePipelines(IPipelines pipelines, TinyIoCContainer container)
    {
        return pipelines;
    }

    public static IMapperConfigurationExpression ConfigureMapper(IMapperConfigurationExpression config, TinyIoCContainer container)
    {
        return config;
    }
}

App Settings

// appsettings.{environment}.json

{
  "ApiSettings": {
    "AppUrl": "http://localhost:5855",
    "JsonSerializer": "Snakecase",
    "PathPrefix": "/myapp/v1",
    "Domain": "MyDomain",
    "Application": "MyApp",
    "Version": "v1",
    "BuildVersion": "1.0.0",
    "SupportedCultures": [ "pt-BR", "es-ES", "en-US" ],
    "DebugMode": true
  },
  "DbSettings": {
    "ConnectionString": "mongodb://user:pass@localhost:27017/DatabaseName",
    "Name": "DatabaseName"
  },
  "HealthcheckSettings": {
    "Enabled": true,
    "Path": "healthcheck/123456",
    "LogEnabled": true
  },
  "LogSettings": {
    "TitlePrefix": "[{Application}] ",
    "JsonBlacklist": [ "*password", "*card.number", "*creditcardnumber", "*cvv" ],
    "SeqOptions": {
      "Enabled": true,
      "MinimumLevel": "Verbose",
      "Url": "http://localhost:5341",
      "ApiKey": "XXXX"
    },
    "SplunkOptions": {
      "Enabled": false,
      "MinimumLevel": "Verbose",
      "Url": "http://localhost:8088/services/collector",
      "Token": "XXXX",
      "Index": "my.index",
      "Application": "MyApp",
      "ProcessName": "MyApp.Domain.App",
      "Company": "MyApp",
      "ProductVersion": "1.0.0",
      "SourceType": "_json"
    },
    "NewRelicOptions" : {
      "Enabled" : true,
      "AppName" : "MyApp",
      "LicenseKey" : "xxxxx"
    }
  },
  "DocsSettings": {
    "Enabled": true,
    "Title": "MyApp API Reference",
    "TermsOfService": "https://myapp.com/terms-of-service",
    "Description": "MyApp Main API",
    "AuthorName": "Thiago Barradas",
    "AuthorEmail": "thbarradas@gmail.com",
    "BasicAuthUser": "user",
    "BasicAuthPass": "pass"
  }
}

Controller

🚧

Models / Validation

🚧

Documentation

🚧

Install via NuGet

PM> Install-Package Nancy.Scaffolding
PM> Install-Package Nancy -Version 2.0.0-clinteastwood
PM> Install-Package Nancy.Serialization.JsonNet -Version 2.0.0-clinteastwood

How can I contribute?

Please, refer to CONTRIBUTING

Found something strange or need a new feature?

Open a new Issue following our issue template ISSUE_TEMPLATE

Changelog

See in nuget version history

Did you like it? Please, make a donate :)

if you liked this project, please make a contribution and help to keep this and other initiatives, send me some Satochis.

BTC Wallet: 1G535x1rYdMo9CNdTGK3eG6XJddBHdaqfX

1G535x1rYdMo9CNdTGK3eG6XJddBHdaqfX