I would like to know the current url with elixir / phoenix framework, how I can get this ?
Edit #1:
My nginx config file:
server {
client_max_body_size 100M;
listen 80;
server_name *.babysittingbordeaux.dev *.babysittingparis.dev
access_log /usr/local/var/log/nginx/baby-access.log;
error_log /usr/local/var/log/nginx/baby-error.log;
location / {
proxy_pass http://127.0.0.1:4000;
}
}
Code:
Atom.to_string(conn.scheme) <> "://" <> (Enum.into(conn.req_headers, %{}) |> Map.get("host")) <> conn.request_path
That example returns http://127.0.0.1:4000/, I would like to get http://www.babysittingbordeaux.dev/
I'm in development mode.
For any company that currently uses Ruby on Rails, Phoenix Framework should be on your radar, because it adds considerable performance gains. To top that off, Phoenix makes it incredibly fast to build web applications.
Phoenix is a web framework built with the Elixir programming language. Elixir, built on the Erlang VM, is used for building low-latency, fault-tolerant, distributed systems, which are increasingly necessary qualities of modern web applications.
Awesome Phoenix web framework Phoenix framework is where Elixir shines. It's built-in a very elegant manner and gives you everything you need to build robust web applications as well as advanced APIs.
You need to get the current site URL of a SharePoint site in SPFx. In JavaScript, we do it using _spPageContextInfo.webAbsoluteUrl. To do the same in SPFx we have to follow the below steps ? using this props, you can get the current site URL where your webpart is being rendered.
With Magento 1 version, it was very easy to get the base URL using Mage::getBaseUrl (); However, it is not easy in Magento 2. You can follow the two methods to Magento to get the current URL: Although the 2nd solution is not recommended as it consumes extensive resources, it does provide the solution and can be used as an alternative.
Conveniences for working with links and URLs in HTML. Generates a button tag that uses the Javascript function handleClick () (see phoenix_html.js) to submit the form data. Generates a link to the given URL. Generates a button tag that uses the Javascript function handleClick () (see phoenix_html.js) to submit the form data.
You can use Phoenix.Controller.current_url/1:
current_url(conn)
The endpoint configuration will define the URL:
config :my_app_web, MyAppWeb.Endpoint, url: [host: "example.com"]
If you are interested only in the request path you can use conn.request_path
which holds a value like "/users/1"
.
To get the URL including the host you can use
MyApp.Router.Helpers.url(conn) <> conn.request_path
which would return a result like "http://localhost:4000/users/1"
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With