krainboltgreene
Suggestion: Verified Routes with Subdomain Support
So verified paths is geniuenly one of the best features of a web framework I’ve ever seen in ~15 years, but I’ve encountered a place where it gets kinda tricky!
So imagine this router:
defmodule CoreWeb.Router do
use CoreWeb, :router
require PhoenixJSONAPI.Routing
pipeline :browser do
plug(:accepts, ["html"])
plug(:fetch_session)
plug(:fetch_live_flash)
plug(:put_root_layout, html: {CoreWeb.Layouts, :root})
plug(:protect_from_forgery)
plug(:put_secure_browser_headers, CoreWeb.get_secure_browser_headers())
end
scope "/", host: "dashboard." do
pipe_through([:browser])
live("/", DashboardWeb.OverviewLive, :index)
end
scope "/", host: "admin." do
pipe_through([:browser])
live("/", AdminWeb.OverviewLive, :index)
end
end
Pretty standard! This actually works and navigation is perfect. For example, inside admin_web/live/overview_live.html.heex if I reference ~p"/" it will be relative to the liveview’s domain.
However you may now realize that what if I want to go from dashboard overview to admin overview? Things become tricky, but not impossible. The annoyance however makes me wonder if the Phoenix team would be open to a change to verified routes: ~p"dashboard:/" or similar?
Most Liked
sodapopcan
Related discussion: [abandoned] Proposal for multiple "~p" sigils
1
Popular in Proposals: Ideas
(re-post of: Feature idea: measure and expose socket latency · Issue #1890 · phoenixframework/phoenix_live_view · GitHub)
This is relate...
New
We are seeing a lot of warning logs like this:
navigate event to "https://someurl" failed because you are redirecting across live_sessio...
New
Hi everyone! Recently I was thinking a lot about the way HEEX renders lists. People are generally surprised about huge payloads being sen...
New
Hi!
I would like to suggest a new callback in the lifecycle of the Live Component which is unmount.
Sometimes it is nice to be able to ...
New
Please change passwordless login from a link to a 6-8 digit code a user can enter.
Gen Auth in the latest RC 1.8 of Phoenix defaults ...
New
Hello! After seeing a couple of posts from Chris and Jose about supporting web components in LiveView, I thought it would be great to ini...
New
Story behind
Recently, I gave a talk on a meetup about improving performance of Phoenix applications and the example app was a LiveView ...
New
I’d like to propose that we refrain from using the term "DeadView" as the opposite of “LiveView” and instead choose an alternative. A new...
New
Hi there :wave:,
I hope everyone is doing well…
Tl;Dr: Is there a use case to have Heroicons from an actual hex.pm package instead of G...
New
So after complaining about this for the third or fourth time on this forum, I figured I should make a proposal.
TL;DR
with can be hard t...
New
Other popular topics
Hi,
I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Hello everybody,
usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
New
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors:
[WARN] - (starship::utils): Executing command ...
New
i’m a new one to elixir
which editor can i use
vs code? or atom?
Thanks! :smiley:
New
What is the proper way to load a module from a file in to IEX?
In the python world, doing something like this pretty standard:
from ....
New
I would like to know what is the best IDE for elixir development?
New
Lets say I have map like this fetching from my database
%{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance










