Hanami 해봤어요.

2125 단어 Rubyhanami

개요


  • 하나미가 루비의 구세주가 될지, 멍청한 행성과 함께 흩어질지

  • DDD(Domain-driven design) 베이스

  • http://hanamirb.org/
  • Hanami is a modern web framework for Ruby.

  • RubyKaigi 2017
  • http://rubykaigi.org/2017/presentations/anton_davydov.html

  • 해봤어요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
    

    계속하다

    # 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
    

    샘플 소스 코드

  • https://github.com/mediba-moritake/sample-hanami
  • 좋은 웹페이지 즐겨찾기