LoginSignup
4
8

More than 5 years have passed since last update.

hanamiを試してみた

Last updated at Posted at 2017-08-29

概要

前提

  • 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

続き

# 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

サンプルソースコード

4
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
8