Ejemplo n.º 1
0
 public static View StringToVoidView(StringView view)
 {
     return (Context context) =>
     {
         var response = view(context);
         if (response != null)
             context.WriteResponse(response);
     };
 }
Ejemplo n.º 2
0
 public void AddStringView(string pattern, StringView view) { urlPatterns.Add(new UrlPattern(pattern, StringToVoidView(view))); }
Ejemplo n.º 3
0
        /// <summary>
        /// Adds a new URL pattern with a static URL.
        /// </summary>
        public void AddStaticStringView(string url, StringView view)
        {
            if (!url.StartsWith("/"))
                url = "/" + url;

            AddView("^" + Regex.Escape(url) + "$", StringToVoidView(view));
        }