Ejemplo n.º 1
0
        public void Run(Http.IHttpListener listener, Http.ILogger logger)
        {

            /*
              TinyRestServerCSharp.TinyRest.Server()
                .WithLogger(new TinyRestServer.ConsoleLogger())
                .WithHttp()
                .WithPort(8001)
                .WithBasePath("/learning")
                .OnGetPath("/", (request, response) => "coucou " + (count++))
                .OnGetPath("/json", (request, response) => response.Json(new
                {
                    Text = "coucou " + (count++)
                }))
                .Create()
                .Listen();
             */

            listener.AddPrefix("http://+:8001");

            var routes = new List<Routing.HttpRoute>();
            
            new RoutesBuilder()
                .OnGetPath("/", (request, response) =>
                    {
                        return "coucou";
                    }
                );
            
        }
Ejemplo n.º 2
0
        public void Start(ITwitterContextList contextList = null)
        {
            try
            {
                ContextList = contextList;
                Http.AddPrefix(Prefix);
                Http.Start();

                LogTo.Info($"Starting proxy server on {Prefix}");
                IsRunning    = true;
                ServerThread = new Thread(RunThreaded);
                ServerThread.Start();
            }
            catch (HttpListenerException ex)
            {
                LogTo.ErrorException("Failed to start media proxy server", ex);
            }
        }