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

Node.js + WP-API でつくるウェブアプリケーション

Node.js + WP-API でつくるウェブアプリケーション

2016/08/27に大阪イノベーションハブで開催されたGRAND FRONTEND OSAKA 2016の資料です。

Takayuki Miyauchi

August 27, 2016
Tweet

More Decks by Takayuki Miyauchi

Other Decks in Programming

Transcript

  1. /PEFKT 81"1*Ͱͭ͘Δ
 ΢ΣϒΞϓϦέʔγϣϯ  (3"/%'30/5&/%04"," !NJZB

  2. ࣗݾ঺հ

  3. http://vccw.cc/

  4. None
  5. None
  6. 81"1*ͱ͸ʁ

  7. w 8PSE1SFTT͔Β࣮૷͞Εͨ৽ػೳ w 8PSE1SFTTΛ+40/3&45"1*Ͱ͝ʹΐ͝ʹΐɻ $ curl http://wp-api.dev/wp-json/wp/v2/posts | jq .

    [ { "id": 1, "date": "2016-05-17T07:28:32", "date_gmt": "2016-05-17T07:28:32", "guid": { "rendered": "http://wp-api.dev/?p=1" }, "modified": "2016-05-17T07:28:32", "modified_gmt": "2016-05-17T07:28:32", "slug": "hello-world", "type": "post",
  8. w ݱ࣌఺ͰϑϧػೳΛ࢖͏ʹ͸81"1*ϓϥάΠϯΛΠ ϯετʔϧ͢Δඞཁ͕͋Δɻ w 8PSE1SFTTͰίΞʹϚʔδ͞ΕΔ༧ఆɻ https://wordpress.org/plugins/rest-api/

  9. 8PSE1SFTTͷ৽ػೳ͸ࣄલʹϓϥάΠϯͱͯ͠ϦϦʔε͞Εɺ
 4MBDL΍(JU)VCͰͷٞ࿦ΛܦͯίΞʹϚʔδ͞Ε·͢ɻ https://make.wordpress.org/core/features-as-plugins/

  10. https://github.com/WP-API

  11. w ਖ਼౷೿3&45GVMͳ"1*ɻ w ϓϥάΠϯʹΑΓ֦ுՄೳɻͨͱ͑͹ϝλσʔ λΛ+40/ʹ௥Ճͨ͠Γͱ͔ɻ w औಘ͍ͨ͠هࣄͷύϥϝʔλΛΫΤϦʔจࣈྻ Ͱࢦఆ͢Δ͜ͱ͕Մೳɻ

  12. /wp-json/wp/v2/posts ౤ߘͷҰཡΛऔಘ *%͕ͷݻఆϖʔδΛऔಘ /wp-json/wp/v2/pages/234 /wp-json/wp/v2/:object/:id

  13. ?filter[s]=hello IFMMPؚ͕·ΕΔهࣄΛऔಘ ΧςΰϦʔ͕GSVJUTͷهࣄΛऔಘ ?filter[category]=fruits https://codex.wordpress.org/Class_Reference/WP_Query 8PSE1SFTTͷ[email protected]ͷύϥϝʔλ͕࢖༻Մ

  14. 81"1*ʹΑΔมԽ

  15. 8PSE1SFTTͷςʔϚγεςϜ͔Β
 ϑϩϯτΤϯυΛղ์ w εϚϗΞϓϦɺσεΫτοϓΞϓϦͳͲͷόοΫΤϯυ ͱͯ͠ͷ8PSE1SFTT

  16. ϚΠΫϩαʔϏεͷҰ෦ͱͯ͠ͷ 8PSE1SFTT w ଞͷ$.4΍ϑϨʔϜϫʔΫ౳ͱͷ༰қͳ࿈ܞ͕Մೳɻ Lambda API Gateway

  17. ຊ൪Ͱ΋εςʔδϯάͰ΋ ϥΠϒσʔλ w ͩͬͯ"1*ͩ΋Μɻ w ϚΠάϨʔγϣϯແ͠Ͱ։ൃΛ࢝ΊΔ͜ͱ΋Մೳɻ

  18. εέʔϦϯά ͳʹͦΕʁ w ͱʹ͔͘Ωϟογϡͪ͠Ό͑ʂ w "84ͷ$MPVE'SPOU΍"1*(BUFXBZ͸௒ศརɻ CloudFront CDN

  19. ϫʔΫϑϩʔͷվળ w όοΫΤϯυͱϑϩϯτΤϯυͷ׬શͳ෼ۀɻ w ϑϩϯτΤϯυσΟϕϩούʔ͸όοΫΤϯυ͕ 8PSE1SFTTͰ͋Δ͜ͱΛ஌Δඞཁ͑͞ͳ͍͔΋ɻ

  20. ࣄྫ

  21. None
  22. w όοΫΤϯυ͸8PSE1SFTTʴ81"1* w ϑϩϯτΤϯυ͸ɺ/PEFKT 3FBDUɻ w ϑϩϯτΤϯυͷΠϯϑϥʹ͸%PDLFSΛ࢖༻ɻ w 044Ͱެ։͞Ε͍ͯ·͢ɻ

  23. None
  24. w 81"1*͔Βऔಘͨ͠σʔλΛ/PEFKTαʔόʔܦ༝ Ͱग़ྗ͢Δ͜ͱͰɺඇಉظॲཧʹΑΔߴ଎ԽΛ࣮ݱɻ w /PEFKTαʔόʔଆͰϨεϙϯε͕Ωϟογϡ͞Εͯ ͓Γ8PSE1SFTT͕μ΢ϯͯ͠΋αΠτ͸Քಇɻ w 8PSE1SFTTͷ؅ཧը໘Λ࢖͏͜ͱͰɺίϯςϯπϥ ΠλʔͷֶशίετΛ௿ݮɻ

  25. None
  26. w ଞͷ$.4͔Β8PSE1SFTTʹҠߦɻ w ಠ࣮ࣗ૷ͷϓϥάΠϯΛ։ൃͯ͠"1*Խɻ w όοΫΤϯυͷ։ൃνʔϜ͸ϑϩϯτΤϯυʹ΄ͱ ΜͲؔ༩͓ͯ͠ΒͣɺҠߦίετΛ௿ݮ͢Δ͜ͱʹ େ͖͘ߩݙɻ

  27. ͦͷଞͷࣄྫ w 5IF/FX:PSL5JNFT w 8JSFE w )BQQZUBCMFT w /PNBEPCBTF

  28. ࠓ೔ͷϋϯζΦϯͷ
 αϯϓϧ

  29. • https://github.com/wckansai2016/node-wp-api • https://github.com/miya0001/ionic-starter- wordpress