Created
November 14, 2018 15:16
-
-
Save shufo/98b01127eb281c6080e30b72e32eefd7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule LogViewer.Server do | |
def start_link() do | |
dispatch = :cowboy_router.compile([ | |
{:_, | |
[ | |
{'/websocket', LogViewer.WebSocketHandler, []}, | |
{"/", :cowboy_static, {:priv_file, :log_viewer, "index.html"}}, | |
{"/_nuxt/[...]", :cowboy_static, {:priv_dir, :log_viewer, "_nuxt"}}, | |
{"/[...]", :cowboy_static, {:priv_file, :log_viewer, "index.html"}} | |
]} | |
]) | |
:cowboy.start_clear(:log_viewer_http_listener, [{:port, 5900}], %{ | |
env: %{dispatch: dispatch} | |
}) | |
end | |
def stop(_state) do | |
:ok | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment