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

APIドキュメントにまつわる試行錯誤 #gotandajs

mizuki_r
September 02, 2016

APIドキュメントにまつわる試行錯誤 #gotandajs

2016-09-02 Gotanda.js #5 の発表資料

mizuki_r

September 02, 2016
Tweet

More Decks by mizuki_r

Other Decks in Technology

Transcript

  1. 最近の開発スタイル ʘUIϑΝʔετʗ ཁ݅ UI API ϞοΫ API αʔ ό ʔ

    ·ͣ͸UI ৘ใΛ੔ཧ͠ αʔόΛ ࡞Γ UIʹ൓ө͢Δ
  2. with Tools ཁ݅ UI API Blueprint API αʔ ό ʔ

    UIΛઃܭ ৘ใΛ੔ཧ αʔόͷߏங UIʹ൓ө API υΩϡϝϯτ API ϞοΫ ࣗಈੜ੒
  3. Controllerが要求するもの • ϦΫΤετͷ൑அ • Method, URL, Parameters • ॲཧͷ൑அ •

    Modelͱ͔Serviceͷ໊લۭؒ • Ϩεϙϯεߏ଄ • HttpStatus, Body, Header
  4. use Amon2::Lite; use JSON::Types; get '/api/user/:user_name' => sub { my

    ($c, $args) = @_; my $params = $c->req->parametes; my %args = map { $_ => $params->{$_} or $args->{$_} } qw(user_name); my $entity = $c->factory('User')->get(%args); return $c->render_json(+{ name => string($entity->name), age => number($entity->age), }); }; __PACKAGE__->to_app;
  5. (SPVQ6TFS (&5BQJVTFS\VTFS@OBNF^ 1BSBNFUFST VTFS@OBNF TUSJOH ʜϢʔβͷࣝผࢠ 3FTQPOTF BQQMJDBUJPOKTPO  #PEZ

    OBNF TUSJOH Ϣʔβͷࣝผࢠ BHF OVNCFS ೥ྸ #PEZ \ OBNFʠNJ[VLJʡ  BHF  ^
  6. まとめ • API-Blueprint with aglio x hariko x ??? •

    API-BlueprintΛ༻͍ͨίʔυͷࣗಈੜ੒