Ejemplo n.º 1
0
 private void setMiddleware()
 {
     this.handler = apiHandler;
     for (int i = this.middlewares.Count - 1; i >= 0; i--)
     {
         this.handler = this.middlewares[i](this.handler);
     }
 }
Ejemplo n.º 2
0
        public void AddHandler(string method, string pattern, Middlewares.HandlerFunc handlerFunc)
        {
            var handlers = getHandlers(method);

            if (handlers == null)
            {
                methods[method] = new Dictionary <string, Middlewares.HandlerFunc>();
                handlers        = methods[method];
            }
            handlers.Add(pattern, handlerFunc);
            string result = string.Format("added handler {0}, {1}", method, pattern);

            Console.WriteLine(result);
        }