2016年9月23日金曜日

開発環境

Head First Ruby (Jay McGavren (著)、O'Reilly Media)のChapter 14.(Web Apps: Serving HTML)、A simple Sinatra app、CODE MAGNETS(No. 7216)を取り組んでみる。

CODE MAGNETS(No. 7216)

コード(Emacs)

#!/usr/bin/env ruby2.3
# -*- coding: utf-8 -*

require 'sinatra'

get('/sandwich') do
  'Make your own sandwich!'
end

入出力結果(Terminal)

$ ./sample1.rb
[2016-09-23 14:23:53] INFO  WEBrick 1.3.1
[2016-09-23 14:23:53] INFO  ruby 2.3.1 (2016-04-26) [x86_64-darwin15]
== Sinatra (v1.4.7) has taken the stage on 4567 for development with backup from WEBrick
[2016-09-23 14:23:53] INFO  WEBrick::HTTPServer#start: pid=2450 port=4567
::1 - - [23/Sep/2016:14:23:58 +0900] "GET /sandwich HTTP/1.1" 200 23 0.0179
::1 - - [23/Sep/2016:14:23:58 JST] "GET /sandwich HTTP/1.1" 200 23
- -> /sandwich
  C-c C-c== Sinatra has ended his set (crowd applauds)
[2016-09-23 14:24:02] INFO  going to shutdown ...
[2016-09-23 14:24:02] INFO  WEBrick::HTTPServer#start done.
$

0 コメント:

コメントを投稿