Esempio n. 1
0
        public static IApplicationBuilder UseNancy(
            this IApplicationBuilder builder,
            Action <NancyOptions> configure = null)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            var opts = new NancyOptions();

            configure?.Invoke(opts);

            return(builder.UseMiddleware <NancyMiddleware>(opts));
        }
Esempio n. 2
0
        public NancyMiddleware(
            NancyOptions options,
            ILogger <NancyMiddleware> logger,
            RequestDelegate next)
        {
            _options = options;
            var bootstrapper =
                _options.Bootstrapper ?? new DefaultNancyBootstrapper(); //new DefaultKestrelBootstrapper();

            bootstrapper.Initialise();
            _engine = bootstrapper.GetEngine();

            _logger = logger;
            _next   = next;
        }