Exemplo n.º 1
0
        public static void Configure(Owin.IAppBuilder app)
        {
            var config = new HttpConfiguration();

            app.UseWebApi(config);
            app.UseCors(CorsOptions.AllowAll);

            config.EnableCors(new EnableCorsAttribute("*", "*", "*"));

            config.MapHttpAttributeRoutes();

            var settings = config.Formatters.JsonFormatter.SerializerSettings;
            //Use camelCaseFormatting
            settings.ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver();

            //Ignore null values
            settings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore;

            config.Formatters.XmlFormatter.MediaTypeMappings.Add(new UriPathExtensionMapping("xml", "text/xml"));
            config.Formatters.JsonFormatter.MediaTypeMappings.Add(new UriPathExtensionMapping("json", "application/json"));
        }
Exemplo n.º 2
0
 public void Configuration(Owin.IAppBuilder app)
 {
     app.MapSignalR();//new HubConfiguration() { EnableCrossDomain = true });
     app.UseNancy(new NancyOptions() { Bootstrapper = new ApplicationBootstrapper() });
     app.UseCors(CorsOptions.AllowAll);
 }