예제 #1
0
        public void SetupHandlers() //todo separate each call
        {
            TemplateEngine.Server.Get("/", request => HTTPResponse.Redirect(AppSettings.UrlHome));

            TemplateEngine.Server.Get(AppSettings.UrlHome, RouteHome);

            TemplateEngine.Server.Post(AppSettings.UrlHome, RouteSearch);

            TemplateEngine.Server.Get(AppSettings.UrlError, RouteError);

            TemplateEngine.Server.Get(AppSettings.UrlTokens, RouteTokens);

            TemplateEngine.Server.Get($"{AppSettings.UrlTokens}/{{input}}", RouteTokensNft);

            TemplateEngine.Server.Get("/marketcap", request =>
            {
                var marketCap = CoinUtils.GetCoinMarketCap().GetAwaiter().GetResult();
                return($"$ {marketCap}");
            });

            TemplateEngine.Server.Get("/rates", request =>
            {
                //var coins = HomeController.GetRateInfo();

                var html = TemplateEngine.Render("", "rates");
                return(html);
            });

            TemplateEngine.Server.Get($"{AppSettings.UrlToken}/{{input}}", RouteToken);

            TemplateEngine.Server.Get($"{AppSettings.UrlTransactions}", RouteTransactions);
            TemplateEngine.Server.Get($"{AppSettings.UrlTransactions}/{{page}}", RouteTransactions);

            TemplateEngine.Server.Get($"{AppSettings.UrlTransaction}/{{input}}", RouteTransaction);

            TemplateEngine.Server.Get($"{AppSettings.UrlAddresses}", RouteAddresses);

            TemplateEngine.Server.Get($"{AppSettings.UrlAddress}/{{input}}", RouteAddress);
            TemplateEngine.Server.Get($"{AppSettings.UrlAddress}/{{input}}/{{page}}", RouteAddress);

            TemplateEngine.Server.Get($"{AppSettings.UrlBlocks}", RouteBlocks);
            TemplateEngine.Server.Get($"{AppSettings.UrlBlocks}/{{page}}", RouteBlocks);

            TemplateEngine.Server.Get($"{AppSettings.UrlBlock}/{{input}}", RouteBlock);

            TemplateEngine.Server.Get($"{AppSettings.UrlChains}", RouteChains);

            TemplateEngine.Server.Get($"{AppSettings.UrlChain}/{{input}}", RouteChain);

            TemplateEngine.Server.Get($"{AppSettings.UrlSoulMasters}", RouteSoulMasters);
            TemplateEngine.Server.Get($"{AppSettings.UrlSoulMasters}/{{page}}", RouteSoulMasters);

            TemplateEngine.Server.Get($"{AppSettings.UrlMarketplace}", RouteMarketplace);
            TemplateEngine.Server.Get($"{AppSettings.UrlMarketplace}/{{chain}}/{{page}}", RouteMarketplace);

            //SetupAPIHandlers(); todo
        }