Skip to content

Commit 521fac6

Browse files
committed
Added a root route and basic root view with timestamp
1 parent f59b8f3 commit 521fac6

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

app/controllers/application_controller.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,14 @@ class ApplicationController < ActionController::Base
22
# Prevent CSRF attacks by raising an exception.
33
# For APIs, you may want to use :null_session instead.
44
protect_from_forgery with: :exception
5+
6+
def root
7+
render text: <<-EOS
8+
<html>
9+
<body>
10+
<p>Hello from #{request.host}. It is <strong>#{Time.now}</strong>!</p>
11+
</body>
12+
</html>
13+
EOS
14+
end
515
end

config/routes.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Rails.application.routes.draw do
22
resources :posts
33

4+
root to: 'application#root'
5+
46
# The priority is based upon order of creation: first created -> highest priority.
57
# See how all your routes lay out with "rake routes".
68

0 commit comments

Comments
 (0)