zcash-explorer/lib/zcash_explorer_web/router.ex

81 lines
2.7 KiB
Elixir
Raw Normal View History

2021-07-07 10:40:43 -07:00
defmodule ZcashExplorerWeb.Router do
use ZcashExplorerWeb, :router
import Phoenix.LiveView.Router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
plug :put_root_layout, {ZcashExplorerWeb.LayoutView, :root}
end
pipeline :api do
plug :accepts, ["json"]
end
scope "/", ZcashExplorerWeb do
pipe_through :browser
get "/", PageController, :index
get "/blocks/:hash", BlockController, :get_block
get "/transactions/:txid", TransactionController, :get_transaction
live "/price", PriceLive
live "/metrics/difficulty", DifficultyLive
live "/metrics/block_count", BlockCountLive
live "/metrics/blockchain_size", BlockChainSizeLive
live "/metrics/mempool_info", MempoolInfoLive
live "/metrics/networksolps", NetworkSolpsLive
live "/index/recent_blocks", RecentBlocksLive
live "/index/recent_transactions", RecentTransactionsLive
2021-07-13 05:35:16 -07:00
live "/live/raw_mempool", RawMempoolLive
2021-07-20 10:10:06 -07:00
live "/live/nodes", NodesLive
2021-08-15 19:41:58 -07:00
live "/vkdetails", VkLive
2021-08-24 23:40:37 -07:00
live "/blockchain-info-live", BlockChainInfoLive
2021-07-07 10:40:43 -07:00
get "/broadcast", PageController, :broadcast
post "/broadcast", PageController, :do_broadcast
get "/payment-disclosure", PageController, :disclosure
post "/payment-disclosure", PageController, :do_disclosure
get "/address/:address", AddressController, :get_address
get "/search", SearchController, :search
2021-07-09 09:54:10 -07:00
get "/blocks", BlockController, :index
2021-07-13 05:35:16 -07:00
get "/mempool", PageController, :mempool
get "/nodes", PageController, :nodes
2021-07-30 06:47:09 -07:00
get "/vk", PageController, :vk
2021-08-15 19:41:58 -07:00
post "/vk", PageController, :do_import_vk
2021-08-24 23:40:37 -07:00
get "/blockchain-info", PageController, :blockchain_info
2022-05-11 10:02:09 -07:00
get "/ua/:address", AddressController, :get_ua
2021-08-15 19:41:58 -07:00
end
scope "/", ZcashExplorerWeb do
pipe_through :api
2022-05-03 06:31:29 -07:00
get "/api/v1/blockchain-info", PageController, :blockchain_info_api
2021-08-15 19:41:58 -07:00
post "/api/vk/:hostname", PageController, :vk_from_zecwalletcli
2021-07-07 10:40:43 -07:00
end
# Other scopes may use custom stacks.
# scope "/api", ZcashExplorerWeb do
# pipe_through :api
# end
# Enables LiveDashboard only for development
#
# If you want to use the LiveDashboard in production, you should put
# it behind authentication and allow only admins to access it.
# If your application does not have an admins-only section yet,
# you can use Plug.BasicAuth to set up some basic authentication
# as long as you are also using SSL (which you should anyway).
if Mix.env() in [:dev, :test] do
import Phoenix.LiveDashboard.Router
scope "/" do
pipe_through :browser
live_dashboard "/dashboard",
metrics: ZcashExplorerWeb.Telemetry,
ecto_repos: [ZcashExplorer.Repo]
end
end
end