예제 #1
0
        public RestService(BtcIndex index)
        {
            _index = index;
            _listener.Prefixes.Add($"http://*:{Configuration.Get().RestPort}/");
            _listener.Start();

            AddEndpoint("POST", "/api/utxo", HandleUtxo);
            AddEndpoint("POST", "/api/balance", HandleBalance);
            AddEndpoint("POST", "/api/balances", HandleBalances);
            AddEndpoint("POST", "/api/history", HandleHistory);
            AddEndpoint("GET", "/api/fees", HandleFees);
            AddEndpoint("POST", "/web/utxo", HandleWebUtxo);
            AddEndpoint("GET", "/", HandleIndex);
        }
예제 #2
0
 static void Main(string[] args)
 {
     try
     {
         Console.CancelKeyPress += Stop;
         using (var index = new BtcIndex(true, Configuration.Get().Testnet))
             using (var service = new RestService(index))
             {
                 service.Run(() => ContinueRunning);
             }
     }
     catch (Exception e)
     {
         Log.Error(e);
     }
 }