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

URLルーティングをつくる

bmf_san
March 31, 2019

 URLルーティングをつくる

bmf_san

March 31, 2019
Tweet

More Decks by bmf_san

Other Decks in Programming

Transcript

  1. ֓ཁ 1. ಈػ 2. ࣗ࡞΁ͷಓͷΓ • લఏɹ • ࣮૷લͷաఔ •

    ࢓༷ͱ͔ઃܭ·ͱΊ 3. ࣮૷ • ۩ମతͳ࣮૷಺༰ʹ͍ͭͯ͸͋·Γ৮Ε·ͤΜɻʢ࣌ؒత౎߹ʣ • ࣮૷͢ΔࡍͷϙΠϯτ 4. ·ͱΊ • ࣗ࡞ͯ͠Έͨॴײ
  2. I/O Input • Path • /foo/bar/1 • HTTP Method •

    GET/POST… • Routing Definition • ϧʔςΟϯάͷఆٛ Output • Action • ॲཧʢฦ͍ͨ͠஋ʣ • ex. PostController@getPosts • Parameters • ύεύϥϝʔλʔ • ex. /boo/bar/1 • /foo/bar/:id • → id 1
  3. Routing 1BUI .FUIPE "DUJPO  (&5 *OEFY$POUSPMMFS!JOEFY QPTUT (&5 1PTU$POUSPMMFS!HFU1PTUT

    QPTUTJE (&5 1PTU$POUSPMMFS!FEJU QPTUTJE 1045 1PTU$POUSPMMFS!VQEBUF QPTUTJEUPLFO (&5 1PTU$POUSPMMFS!QSFWJFX QPTUTDBUFHPSZ (&5 1PTU$POUSPMMFS!HFU1PTUT#Z$BUFHPSZ QSPpMF (&5 1SPpMF$POUSPMMFS!HFU1SPpMF
  4. Routing 1BUI .FUIPE "DUJPO  (&5 *OEFY$POUSPMMFS!JOEFY QPTUT (&5 1PTU$POUSPMMFS!HFU1PTUT

    QPTUTJE (&5 1PTU$POUSPMMFS!FEJU QPTUTJE 1045 1PTU$POUSPMMFS!VQEBUF QPTUTJEUPLFO (&5 1PTU$POUSPMMFS!QSFWJFX QPTUTDBUFHPSZ (&5 1PTU$POUSPMMFS!HFU1PTUT#Z$BUFHPSZ QSPpMF (&5 1SPpMF$POUSPMMFS!HFU1SPpMF
  5. σʔλߏ଄ 1BUI .FUIPE "DUJPO  (&5 *OEFY$POUSPMMFS!JOEFY QPTUT (&5 1PTU$POUSPMMFS!HFU1PTUT

    QPTUTJE (&5 1PTU$POUSPMMFS!FEJU QPTUTJE 1045 1PTU$POUSPMMFS!VQEBUF QPTUTJEUPLFO (&5 1PTU$POUSPMMFS!QSFWJFX QPTUTDBUFHPSZ (&5 1PTU$POUSPMMFS!HFU1PTUT#Z$BUFHPSZ QSPpMF (&5 1SPpMF$POUSPMMFS!HFU1SPpMF
  6. UPLFO &/%@10*/5 &/%@10*/5 &/%@10*/5 &/%@10* /5 QSPpMF  DBUFHPSZ &/%@10*/5

    QPTUT JE &/%@10*/5 (&5QPTUT 
  7. UPLFO &/%@10*/5 &/%@10*/5 &/%@10*/5 &/%@10* /5 QSPpMF  DBUFHPSZ &/%@10*/5

    QPTUT JE &/%@10*/5 (&5QPTUT 
  8. UPLFO &/%@10*/5 &/%@10*/5 &/%@10*/5 &/%@10* /5 QSPpMF  DBUFHPSZ &/%@10*/5

    QPTUT JE &/%@10*/5 (&5QPTUT 
  9. UPLFO &/%@10*/5 &/%@10*/5 &/%@10*/5 &/%@10* /5 QSPpMF  DBUFHPSZ &/%@10*/5

    QPTUT JE &/%@10*/5 (&5QPTUT  (&51PTU$POUSPMMFS!HFU1PTUT 10451PTU$POUSPMMFS!FEJU )551ϝιουʹԠͯ͡ॲཧΛৼΓ෼͚ ˞QBSBNFUFST΋Ұॹʹฦ͢
  10. ՝୊ • ͪΌΜͱ΍Ε͍ͯͳ͍ • ΤϥʔϋϯυϦϯά • ࣮ߦ଎౓ͷߟྀ • ໦ߏ଄ɺจࣈྻ୳ࡧΞϧΰϦζϜΛֶͿ •

    Ͱ͖ͨΒྑͦ͞͏ • ωʔϜϧʔτʢϧʔςΟϯάͷάϧʔϐϯάʣ • ύεύϥϝʔλʔʹਖ਼نදݱΛ࢖͑ΔΑ͏ʹ͢Δ • :id → \d ਺஋͚ͩώοτ͢ΔΑ͏ʹ͢Δɺͱ͔ • ϛυϧ΢ΣΞͱͷͭͳ͗ࠐΈ
  11. ͓·͚ • bmf-tech.com • URLϧʔςΟϯάΛͭ͘ΔɹΤϐιʔυ1 • https://bmf-tech.com/posts/ URL%E3%83%AB%E3%83%BC%E3%83%86%E3%82%A3%E3%83%B3%E3%82%B0%E3%82%92%E3%81%A4%E3% 81%8F%E3%82%8B%E3%80%80%E3%82%A8%E3%83%94%E3%82%BD%E3%83%BC%E3%83%891 •

    URLϧʔςΟϯάΛͭ͘ΔɹΤϐιʔυ2 • https://bmf-tech.com/posts/ URL%E3%83%AB%E3%83%BC%E3%83%86%E3%82%A3%E3%83%B3%E3%82%B0%E3%82%92%E3%81%A4%E3% 81%8F%E3%82%8B%E3%80%80%E3%82%A8%E3%83%94%E3%82%BD%E3%83%BC%E3%83%892 • URLϧʔςΟϯάΛͭ͘ΔɹΤϐιʔυ3ʢ׬݁ฤʣ • https://bmf-tech.com/posts/ URL%E3%83%AB%E3%83%BC%E3%83%86%E3%82%A3%E3%83%B3%E3%82%B0%E3%82%92%E3%81%A4%E3% 81%8F%E3%82%8B%E3%80%80%E3%82%A8%E3%83%94%E3%82%BD%E3%83%BC%E3%83%893%EF%BC%88% E5%AE%8C%E7%B5%90%E7%B7%A8%EF%BC%89 • Speakerdeck • URLϧʔςΟϯάΛͭ͘ΔΤϐιʔυ1 • https://speakerdeck.com/bmf_san/urlruteinguwotukuruepisodo1