Browse Source

Add static hello world page

master
Piotr Orzechowski 1 month ago
parent
commit
903ab33afd
4 changed files with 12 additions and 0 deletions
  1. +7
    -0
      hello/lib/hello_web/controllers/hello_controller.ex
  2. +1
    -0
      hello/lib/hello_web/router.ex
  3. +1
    -0
      hello/lib/hello_web/templates/hello/world.html.eex
  4. +3
    -0
      hello/lib/hello_web/views/hello_view.ex

+ 7
- 0
hello/lib/hello_web/controllers/hello_controller.ex View File

@@ -0,0 +1,7 @@
defmodule HelloWeb.HelloController do
use HelloWeb, :controller

def world(conn, _params) do
render(conn, "world.html")
end
end

+ 1
- 0
hello/lib/hello_web/router.ex View File

@@ -16,6 +16,7 @@ defmodule HelloWeb.Router do
scope "/", HelloWeb do
pipe_through :browser

get "/hello", HelloController, :world
get "/", PageController, :index
end


+ 1
- 0
hello/lib/hello_web/templates/hello/world.html.eex View File

@@ -0,0 +1 @@
<h1>From template: Hello world!</h1>

+ 3
- 0
hello/lib/hello_web/views/hello_view.ex View File

@@ -0,0 +1,3 @@
defmodule HelloWeb.HelloView do
use HelloWeb, :view
end

Loading…
Cancel
Save