Exemplo n.º 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            var path = env.IsDevelopment() ? env.ContentRootPath : "/app/";

            var unpacker = new Unpacker();
            var storage  = new Storage(path, () => TimeSpan.FromMinutes(30));

            IHandler playlistUnpacker = new PlaylistUnpacker(unpacker, storage);
            IHandler playlistGetter   = new GetPlaylistHandler(storage);

            IHandler otherRequestsHandler = new OtherRequestsHandler();

            var router = new Router(tuple =>
                                    (tuple.method.ToUpper(), tuple.path.ToLower()) switch
            {
                ("POST", "/playlist") => playlistUnpacker,
                ("GET", "/playlist") => playlistGetter,
                _ => otherRequestsHandler
            });
Exemplo n.º 2
0
 public void GetPlaylist(int id, GetPlaylistHandler handler, object state)
 {
 }