Esempio n. 1
0
        public void InitializeHttpApi()
        {
            _httpServer = new HttpServer();
            HttpRequestDispatcher httpRequestDispatcher = new HttpRequestDispatcher(_httpServer);

            _apiController = httpRequestDispatcher.GetController("api");
            _apiController.Handle(HttpMethod.Get, "read").Using(HandleApiRead);
            _apiController.Handle(HttpMethod.Post, "write").Using(HandleApiWrite);
            _httpServer.StartAsync(80).Wait();
        }
        private void InitializeHttpApi()
        {
            _httpServer = new HttpServer();
            var httpRequestDispatcher = new HttpRequestDispatcher(_httpServer);

            HttpApiController = httpRequestDispatcher.GetController("api");

            var appPath = Path.Combine(ApplicationData.Current.LocalFolder.Path, "app");

            httpRequestDispatcher.MapFolder("app", appPath);
        }