Skip to content

Adds CSV support to Nancy using CsvHelper

License

Notifications You must be signed in to change notification settings

syncromatics/csvialize

Repository files navigation

Csvialize

Adds CSV support to Nancy using CsvHelper

Quickstart

Add the csvialize NuGet package to your project in the manner applicable to you.

If you're using Nancy's auto-registration, there should be no additional work to do. Requests with an Accept: text/csv header will be negotiated as CSV output.

It may be desirable to change the order of the default IResponseProcessor so that requests without an Accept header are negotiated as desired. For example, this will ensure that Csvialize is the default response processor.

public class CsvFirstBootstrapper : DefaultNancyBootstrapper
{
    protected override NancyInternalConfiguration InternalConfiguration => NancyInternalConfiguration.WithOverrides(c =>
    {
        // Remove Csvialize if it exists
        c.ResponseProcessors.Remove(typeof(Csvialize.CsvProcessor));

        // Insert it at the start of the list
        c.ResponseProcessors.Insert(0, typeof(Csvialize.CsvProcessor));
    });
}

See The response processors in the Nancy wiki for more information.

Building

AppVeyor NuGet NuGet Pre Release

This library is built with .NET Core

To build the project:

dotnet restore
dotnet build

To run the tests:

dotnet test

Code of Conduct

We are committed to fostering an open and welcoming environment. Please read our code of conduct before participating in or contributing to this project.

Contributing

We welcome contributions and collaboration on this project. Please read our contributor's guide to understand how best to work with us.

License and Authors

GMV Syncromatics Engineering logo GMV Syncromatics Engineering

license GitHub contributors

This software is made available by GMV Syncromatics Engineering under the MIT license.