Kintull / tik_tok_toe

Tiktok live stream gaming
19 stars 2 forks source link

Phoenix.Router.NoRouteError #1

Open mesofranico opened 1 year ago

mesofranico commented 1 year ago

Any help pls

[info] Running TicPhxWeb.Endpoint with cowboy 2.9.0 at 127.0.0.1:4000 (http)
[debug] Downloading esbuild from https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.0.tgz
[info] Access TicPhxWeb.Endpoint at http://localhost:4000
[watch] build finished, watching for changes...
[info] GET /
[debug] ** (Phoenix.Router.NoRouteError) no route found for GET / (TicPhxWeb.Router)
    (tic_phx 0.1.0) lib/phoenix/router.ex:406: TicPhxWeb.Router.call/2
    (tic_phx 0.1.0) lib/tic_phx_web/endpoint.ex:1: TicPhxWeb.Endpoint.plug_builder_call/2
    (tic_phx 0.1.0) lib/plug/debugger.ex:136: TicPhxWeb.Endpoint."call (overridable 3)"/2
    (tic_phx 0.1.0) lib/tic_phx_web/endpoint.ex:1: TicPhxWeb.Endpoint.call/2
    (phoenix 1.6.6) lib/phoenix/endpoint/cowboy2_handler.ex:54: Phoenix.Endpoint.Cowboy2Handler.init/4
    (cowboy 2.9.0) c:/Users/mesof/Desktop/tik_tok_toe/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
    (cowboy 2.9.0) c:/Users/mesof/Desktop/tik_tok_toe/deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3
    (cowboy 2.9.0) c:/Users/mesof/Desktop/tik_tok_toe/deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3
    (stdlib 4.0.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Kintull commented 1 year ago

@mesofranico hello, please check router.ex file for available routes.

But in short you can use these routes:

GET /tiktok - render the board POST /comment - parse comment and trigger the command

mesofranico commented 1 year ago

https://ibb.co/8g4VVwG

defmodule TicPhxWeb.Router do use TicPhxWeb, :router

pipeline :live_pipeline do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, {TicPhxWeb.LayoutView, :root} plug :protect_from_forgery plug :put_secure_browser_headers end

pipeline :comments do plug :accepts, ["html"] plug :fetch_session end

pipeline :api do plug :accepts, ["json"] end

scope "/", TicPhxWeb do pipe_through :live_pipeline live "/tiktok", TikTokToeLive.Index, :index end

scope "/", TicPhxWeb do pipe_through :comments post "/comment", CommentsController, :index post "/reset", GameController, :reset end

Other scopes may use custom stacks.

scope "/api", TicPhxWeb 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 :live_pipeline

  live_dashboard "/dashboard", metrics: TicPhxWeb.Telemetry
end

end

Enables the Swoosh mailbox preview in development.

#

Note that preview only shows emails that were sent by the same

node running the Phoenix server.

if Mix.env() == :dev do scope "/dev" do pipe_through :live_pipeline

  forward "/mailbox", Plug.Swoosh.MailboxPreview
end

end end