mishka-cms icon indicating copy to clipboard operation
mishka-cms copied to clipboard

Create an example and demo `on_router` event

Open shahryarjb opened this issue 2 years ago • 0 comments

  • [ ] Should be rechecked in real-example, consider type of @type and defstruct
  • [ ] Do not use it until a stable version is released
  • [ ] why this type() was created?

elixir macros for router

  live(path, live_view, action \\ nil, opts \\ [])
  live "/", TrackappWeb.Live.DepGetter

  delete(path, plug, plug_opts, options \\ [])
  delete("/events/:id", EventController, :action)

  forward(path, plug, plug_opts \\ [], router_opts \\ [])
  forward "/admin", SomeLib.AdminDashboard

  get(path, plug, plug_opts, options \\ [])
  get("/events/:id", EventController, :action)

  post(path, plug, plug_opts, options \\ [])
  post("/events/:id", EventController, :action)

  put(path, plug, plug_opts, options \\ [])
  put("/events/:id", EventController, :action)

  scope "/" do
    pipe_through :browser
    Enum.map(["1", "2"], fn x ->
      live("/x", TrackappWeb.Live.DepGetter)
    end)
  end

shahryarjb avatar Nov 22 '22 16:11 shahryarjb