예제 #1
0
        public void Register(IHttpApi api)
        {
            api.Bind("/{host}?search=x", Verb.Get, r => r.RequestUri.Scheme == Uri.UriSchemeHttp)
            .To(new
            {
                host   = string.Empty,
                search = string.Empty
            }, x =>
            {
                var results = GetIndex(x.host).Search(x.search.ToLower());

                return(Task.FromResult(results));
            });

            api.Bind("/logs/search?q=x", Verb.Get, r => r.RequestUri.Scheme == Uri.UriSchemeHttp)
            .To(string.Empty, QueryAsync);
        }
예제 #2
0
 public void Register(IHttpApi api)
 {
     api.Bind("/source?host=a&path=b&id=c", Verb.Get)
     .To(new
     {
         host = string.Empty,
         path = string.Empty,
         id   = string.Empty
     }, x => GetRequestSource(x.host, x.path, Guid.Parse(x.id)));
 }
예제 #3
0
        public void Register(IHttpApi api)
        {
            api.Bind("/logs/features/map/{x}").To(10, async x =>
            {
                var data = await Read();

                var map = await data.AsQueryable().CreatePipeline().ToSofm(x).ExecuteAsync();

                return(map);
            });
        }
예제 #4
0
        public void Register(IHttpApi api)
        {
            api.Bind("/", Verb.Get)
            .To(false, x => Task.FromResult(ListHosts().Items.ToList()));

            api.Bind("/logs/list/{x}", Verb.Get)
            .To((long)0, x => GetRecentRequests(x));

            api.Bind("/logs/url-filter/{pos}?path=y", Verb.Get)
            .To(new
            {
                pos  = (long)0,
                path = string.Empty
            }, x => GetRequestsByPartialUrl(x.path, x.pos));

            api.Bind("/logs/tree/{x}", Verb.Get)
            .To((long)0, x => GetRequestTree(x));

            api.Bind("/logs/histogram/time-series/all/{x}", Verb.Get)
            .To(1000d, x => GetHistogram(x));

            api.Bind("/logs/histogram/time-series/by-mime/{x}", Verb.Get)
            .To(1000d, x => GetHistogramGroupedByMime(x));
        }