Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Crystal で実際のウェブサービスは作れるのか?

Crystal で実際のウェブサービスは作れるのか?

『 東京 Crystal 勉強会 #3 in 恵比寿 』 の発表資料
http://crystal.connpass.com/event/22754/

Pine Mizune

January 22, 2016
Tweet

More Decks by Pine Mizune

Other Decks in Programming

Transcript

  1. 4IBSET3PDLT$SZTUBM֎ͷٕज़બ୒ •  ϑϩϯτΤϯυ ü  41"ߏ੒ ü  ϑϨʔϜϫʔΫ7VF 1VSFDTT ü  ݴޠɾπʔϧ-JWF4DSJQU

    -&44 +BEF HVMQ 8FCQBDL  •  +PC8PSLFS ü  (PW ü  ύοέʔδ؅ཧHPN ü  ϥΠϒϥϦHPXPSLFS
  2. ґଘ؅ཧTIBSET 4IBSET  •  ݴޠඪ४ͷύοέʔδϚωʔδϟ •  :".-ܗࣜͰTIBSEZNMʹఆٛ •  ࠶ؼతʹґଘղܾ • 

    ґଘύοέʔδ͸(JUͰμ΢ϯϩʔυ •  ໨ཱͬͨෆ۩߹ͳ҆͘ఆಈ࡞ "VUIPS ZTCBEEBEFO <$SZTUBM$PMMBCPSBUPS>
  3. name: sharock_api version: 0.1.0 dependencies: kemal: github: sdogruyol/kemal version: ~>

    0.7.0 mysql: github: waterlink/crystal-mysql version: ~> 0.4.0 redis: github: stefanwille/crystal-redis version: ~> 1.2.1 pool: github: ysbaddaden/pool version: ~> 0.2.0 resque_client: github: pine613/crystal-resque-client version: 0.1.0 sharock_resolver: github: shardsrocks/sharock-resolver branch: master authors: - Pine Mizune <[email protected]> license: MIT TIBSEZNM ґଘఆٛ •  ϥΠϒϥϦ໊ •  ϦϙδτϦ •  όʔδϣϯ
  4. require "kemal" # Dispatcher get "/" do "Hello World!" end

    # WebSocket ws "/socket" do |socket| socket.send "Hello from Kemal!" end ,FNBM ˞ެࣜαΠτIUUQLFNBMDSDPN
  5. DSZTUBMNZTRM def find_one_latest_version(package_id) params = { “package_id” => package_id }

    inflate_one ::MySQL::Query .new(%{ SELECT * FROM `package_deps` WHERE `package_id` = :package_id ORDER BY `version` DESC LIMIT 1 }, params) .run(@conn) end ˞4IBSET3PDLTͷ࣮ࡍͷίʔυ
  6. σʔλϕʔε3FEJT DSZTUBMSFEJT  •  1VSF$SZTUBM •  ര଎ –  DSZTUBMSFEJT ίϚϯυඵ

    –  SFEJTSC ίϚϯυඵ •  ׬੒౓͕ඇৗʹߴ͍ "VUIPS TUFGBOXJMMF