コード例 #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,
         });
     });
 }
コード例 #2
0
ファイル: Startup.cs プロジェクト: mitchydeath/LightNode
        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));
                });
            });
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: mitchydeath/LightNode
        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
                });
            });
        }