Skip to content

Instantly share code, notes, and snippets.

@shufo
Created November 14, 2018 15:16
Show Gist options
  • Save shufo/98b01127eb281c6080e30b72e32eefd7 to your computer and use it in GitHub Desktop.
Save shufo/98b01127eb281c6080e30b72e32eefd7 to your computer and use it in GitHub Desktop.
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