Exemplo n.º 1
0
 public void Configuration(LightNode.IAppBuilder app)
 {
     app.Map("/api", builder =>
     {
         builder.UseLightNode(new LightNodeOptions(AcceptVerbs.Get | AcceptVerbs.Post, new JsonNetContentFormatter())
         {
             StreamWriteOption = StreamWriteOption.BufferAndWrite,
             ParameterEnumAllowsFieldNameParse = true,
             ErrorHandlingPolicy            = ErrorHandlingPolicy.ReturnInternalServerErrorIncludeErrorDetails,
             OperationMissingHandlingPolicy = OperationMissingHandlingPolicy.ReturnErrorStatusCodeIncludeErrorDetails,
         });
     });
 }
Exemplo n.º 2
0
        public void Configuration(LightNode.IAppBuilder app)
        {
            app.EnableGlimpse();
            app.Map("/api", builder =>
            {
                builder.UseLightNode(new LightNodeOptions(AcceptVerbs.Get | AcceptVerbs.Post, new JilContentFormatter(), new GZipJilContentFormatter())
                {
                    OperationCoordinatorFactory       = new GlimpseProfilingOperationCoordinatorFactory(),
                    StreamWriteOption                 = StreamWriteOption.BufferAndWrite,
                    ParameterEnumAllowsFieldNameParse = true,
                    ErrorHandlingPolicy               = ErrorHandlingPolicy.ReturnInternalServerErrorIncludeErrorDetails,
                    OperationMissingHandlingPolicy    = OperationMissingHandlingPolicy.ReturnErrorStatusCodeIncludeErrorDetails,
                    Logger = LightNode.Diagnostics.LightNodeEventSource.Log
                });
            });
            app.Map("/swagger", builder =>
            {
                var xmlName = "LightNode.Sample.GlimpseUse.xml";
                var xmlPath = HttpContext.Current.Server.MapPath("~/bin/" + xmlName);
                //var xmlPath = System.AppDomain.CurrentDomain.BaseDirectory + "\\" + xmlName;

                builder.UseLightNodeSwagger(new Swagger.SwaggerOptions("LightNodeSample", "/api")
                {
                    XmlDocumentPath    = xmlPath,
                    IsEmitEnumAsString = true
                });
            });

            app.MapWhen(x => !x.Request.Path.Value.StartsWith("/Glimpse.axd", StringComparison.InvariantCultureIgnoreCase), builder =>
            {
                builder.Run(ctx =>
                {
                    ctx.Response.StatusCode = 404;
                    return(Task.FromResult(0));
                });
            });
        }
Exemplo n.º 3
0
        public void Configuration(LightNode.IAppBuilder app)
        {
            app.Map("/api", builder =>
            {
                builder.UseLightNode(new LightNodeOptions(AcceptVerbs.Get | AcceptVerbs.Post, new JilContentFormatter(), new GZipJilContentFormatter())
                {
                    StreamWriteOption = StreamWriteOption.BufferAndWrite,
                    ParameterEnumAllowsFieldNameParse = true,
                    ErrorHandlingPolicy            = ErrorHandlingPolicy.ReturnInternalServerErrorIncludeErrorDetails,
                    OperationMissingHandlingPolicy = OperationMissingHandlingPolicy.ReturnErrorStatusCodeIncludeErrorDetails,
                });
            });
            app.Map("/swagger", builder =>
            {
                var xmlName = "LightNode.Sample.Server.SelfHost.xml";
                var xmlPath = System.AppDomain.CurrentDomain.BaseDirectory + "\\" + xmlName;

                builder.UseLightNodeSwagger(new Swagger.SwaggerOptions("LightNodeSample", "/api")
                {
                    XmlDocumentPath    = xmlPath,
                    IsEmitEnumAsString = true
                });
            });
        }