ユーザ用ツール

サイト用ツール


sinatra

Sinatra

Getting start

bundlerを使う場合

$ bundle init

Gemfileを修正。webサーバとしてwebrickかpumaのどちらかが必要

# frozen_string_literal: true
 
source "https://rubygems.org"
 
gem "sinatra"
gem "puma"
# gem "webrick" 
$ bundle install

app.rbを作成して以下を記述

require 'sinatra'
 
get '/' do
  "Hello"
end

起動

$ bundle exec ruby app.rb

http://localhost:4567 にアクセスして、Helloと出たらOK

sinatra.txt · 最終更新: 2023/09/01 01:34 by nullpon