Beispiel #1
0
        public void Configuration(IAppBuilder app)
        {
            var config = new HttpConfiguration
            {
                DependencyResolver = new NinjectResolver(NinjectConfig.CreateKernel())
            };

            WebApiConfig.Register(config);

            var cors = new EnableCorsAttribute("*", "*", "*");

            config.EnableCors(cors);

            config.Formatters.Clear();
            config.Formatters.Add(new JsonMediaTypeFormatter());

            Mapper.Initialize(mapper =>
            {
                mapper.CreateMap <FoodItem, FoodItemViewModel>().ReverseMap();
                mapper.CreateMap <FoodList, FoodListViewModel>().ReverseMap();
                mapper.CreateMap <SharedFoodList, SharedFoodListViewModel>().ReverseMap();
            });

            ConfigureAuthentication.ConfigureAuth(app);

            app.UseWebApi(config);
        }
        public void Configuration(IAppBuilder app)
        {
            var config = new HttpConfiguration
            {
                DependencyResolver = new NinjectResolver(NinjectConfig.CreateKernel())
            };

            WebApiConfig.Register(config);

            var cors = new EnableCorsAttribute("*", "*", "*");

            config.EnableCors(cors);

            config.Formatters.Clear();
            config.Formatters.Add(new JsonMediaTypeFormatter());

            MappingConfig.CreateMappings();

            ConfigureAuthentication.ConfigureAuth(app);

            app.UseWebApi(config);
        }