概要
- HanamiはRubyの救世主(メシア)となるか、愚かな星と散るのか
-
http://hanamirb.org/
- Hanami is a modern web framework for Ruby.
- RubyKaigi 2017
- Getting Startedを試してみました。
前提
- macOS Sierra 10.12.5
- Ruby 2.4.1
hanamiインストール
$ mkdir sample_hanami
$ cd sample_hanami
$ bundle init
$ vim Gemfile
+ gem 'hanami'
$ bundle install --path vendor/bundle
hanamiプロジェクト作成
$ bundle exec hanami new . --database=mysql
$ bundle install --path vendor/bundle
hanamiサーバー起動
$ bundle exec hanami server
ブラウザ起動
$ open http://localhost:2300
![スクリーンショット 2017-08-28 14.49.49.png](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F140713%2F9babc05c-c5f8-fc09-33e7-377129b71dfd.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=9e15114146d1bd5c3e928d7c18a2dc6a)
続き
# Action生成
$ bundle exec hanami generate action web books#index
$ bundle exec hanami generate action web books#new
$ bundle exec hanami generate action web books#create
# Model生成
$ bundle exec hanami generate model book
# DB Migrate (migrationsファイルを編集し、必要なカラムを追加する)
$ bundle exec hanami db prepare