ãã®ããã°ã®é·æè¦ç´ã·ã¹ãã ãå®æããã
ããã°ã©ãã³ã°ãã®ãã¼ï¼ãä»æ¥ã¯ã»ã¨ãã©ä¸æ¥ä¸ã³ã¼ãã£ã³ã°ããã¦éããã¦ãããããããã§ã¨ãã¨ãèªåã®ããã°ã®é·æè¦ç´ã·ã¹ãã ãå®æãã¾ãããããããªæãã§åããã®ã¯åã®æ¥ã®ãã¼ã¸ã¨ãè¦ã¦ã»ããã
æ·±å¤ã«ãããå¦çã§ãã¯ã¦ãªããã°ã®ãã¼ã¿ããããã¤ã³ã¿ã¼ãããã®MySQLã«ä¿åãã¦ããã¡ãããææ¥æ°è社ã®é·æè¦ç´APIã«æ¥ç¶ãã¦è¦ç´æãä¿åãããããªä»çµã¿ãä½ã£ãã®ããã§ãã¯ã¦ãªããã°ã®æ¹ã¯Ajaxéä¿¡ã§ãããã¤ã³ã¿ã¼ãããã«ãã¼ã¿ãåãã«è¡ã£ã¦ããã¼ã¿ã表示ãããã¿ãããªä»çµã¿ãä½ã£ãã
ä»äºãç¹å¿æã ã£ãããä¼ã¿ããéçºã§ããªãã¦å®æãããã¾ã§ã«ä¸é±éãããæãã£ã¦ãã¾ã£ããªãã§ãç¡äºå®æããããã¨ãã§ãã¦è¯ãã£ããéä¸ã§é£½ãã¦ã»ã£ã½ãã ãã¨ããã±ã¼ã¹ãèããããã®ã§ãå®æãããããã®ã¯ç´ æ´ãããã¨èªåãè¤ãã¦ãããããããã°ã«ã¹ã¿ãã¤ãºã¯æ¥½ããããããããçµãã£ãããä»åº¦ããFlutterã§ãªãã趣å³ã®ã¢ããªéçºããããä»äºã§ãã¢ããªéçºãã¦ããã©ããèªåã§è¶£å³ã®ã¢ããªã£ã¦éçºãããã¨ããªãã£ãã®ããããªãããããã¼ã«ããã辺ããTodoã®ã¢ããªã®ãµã³ãã«ã¨ããããããã®ãæ¾ã£ã¦æ¥ã¦ãéæ¹é ãã¦èªååãã®æå¼·ã®Todoã¢ããªãéçºãã¦ã¿ããã
ãã®é·æè¦ç´ã®ããã°ã«ã¹ã¿ãã¤ãºãªãã ãã©ãå®ã¯åã®ã¢ã¤ãã£ã¢ã§ã¯ãªãã®ã ãããã¡ãã®ãããã (id:Windymelt)ããã®è¨äºã§ææ¥æ°è社ã®é·æè¦ç´APIãç´¹ä»ããã¦ããããããããããããã¼ãã¨æã£ã¦èªåã§ä½ããã¨ã«ãã¦ãã¾ã£ãã
ã ãã©ãAWSã使ã£ã¦ãªãããããããã¨ããã§ãã£ããæ«æãããã°éã³ã¯ã§ããã ãéãæããã«ããããããã©ããªãµãã«AWSã®ãµã¼ãã¹çµã¿åããã¦ããã°æ ¼å®ã§ã§ããã®ããã£ã±ãããããªããGoogle Cloudã ã£ããç¡æã®æ å ã§ã§ããããããªããã¼ï¼ã¨æã£ã¦è²ã ã¨èª¿ã¹ã¦ã¿ããã©ã調ã¹ç©ãããã ãã§åå°½ãããã«ãªããã¨ã«æ°ãã¤ãã¦ããã®ã§ããµã¯ãã¨ãªã³ãã¬ã§å ¨é¨æ¸ã¾ãã¦ãã¾ããã¨ã«ãããåã¯ãããã¤ã³ã¿ã¼ãããã¨ã¹ã¿ã³ãã¼ããã©ã³ãå¥ç´ãã¦ã¦ããã¡ãã§ãªããè²ããªRSSåã£ã¦ãããã¿ãããªéäºç¨ã®ã¹ã¯ãªããã¨ãèµ°ããã¦ããã®ã§ããã®ä¸ã«é·æè¦ç´ã®å¦çã追å ããã
ä»çµã¿èªä½ã¯ãï¼æã«crontabã§ã¯ã¦ãªããã°ã®ãã¡ãã®APIãããã¼ã¿ãåã£ã¦ãã¦ãããã¤ã³ã¿ã¼ãããã®MySQLã«ä¿åã
ããã¦ãï¼æããã«ãããã¤ã³ã¿ã¼ãããã®DBã®ä¸èº«ã§ã¾ã è¦ç´ããã¦ãªããã¼ã¿ãæ¢ãåºãã¦ãï¼æ¥ã«ï¼ï¼ä»¶ã ãææ¥æ°èã®é·æè¦ç´APIã«ã¦å¦çãã¦è¦ç´æãåå¾ããã®åå¾ããè¦ç´æãã¾ãMySQLã®å¥ãã¼ãã«ã«ä¿åãã¦ãã¯ã¦ãªããã°ã®ãã¼ã¸ããã¼ããããã¨ãã«ãµã¼ãã«èªã¿ã«è¡ãããã«ããã
ã¯ã¦ãªããã°ãããã¼ã¿ãåã£ã¦ãã¦ä¿åå¦çã«ã¤ãã¦ã¯ãGitHubã§å ¬éãã¦ããã®ã§ãã¡ãã®æ¹ã確èªãã¦ãããã°ããããã ããã
ã§ããã°ä»ã®äººãåèã«ããªããç°¡åã«ãããªããããªã·ã¹ãã ãçµããããã«è§£èª¬è¨äºãªãããä½ãããããããã ãã©ããã¤ã«ãªããã¯åããããªããæè¿ãããã°ã«ã¹ã¿ãã¤ãºç±ãç±ããªã£ã¦ãããè²ã ã¨ããã°ã«ã«ã¹ã¿ãã¤ãºãå ãã¦ããã®ã ãã©ãã©ã³ãã ã¢ã¯ã»ã¹ãã¿ã³ã¿ãããªéè¦ãããããã°ãã¼ãã«é¢ãã¦ã¯ãããã¥ã¡ã³ãã®ä½ãæ¹ã®åå¼·ãã¦ãä½ã解説è¨äºãæ¸ããããªã¼ã¨æã£ã¦ãã
ããããã®å±æã¨ãã¦ã¯ãä»ã®é·æè¦ç´ã®ããæ¹ã¨ãã¦ã¯ææ¥æ°èã®é·æè¦ç´APIãå©ç¨ãã¦ãã£ã¦ãã®ã ãã©ãããã¯ï¼æ¥ï¼ï¼ä»¶ã¾ã§ããè¦ç´ãããã¨ãã§ããªãã®ãããã¡ããèªåã§pythonãªããã§ç¨æã§ããªãããªã¼ã¨æã£ã¦è²ã ã¨è³æãéãã¦ãã
pythonã®ã©ã¤ãã©ãªã使ã£ã¦é·æè¦ç´ã®APIãç¨æãã¦ãGoogle Cloudã®Cloud runã¨ãHerokuã®ç¡ææ ã§éç¨ãããã¨ãã§ããªãããªã¼ã¨æã£ã¦è²ã
ã¨èª¿ã¹ã¦ãããããã¯ã¨ã³ããè²ã
ã¨åå¼·ãããã¨æã£ã¦ãããå¾ã
ã«ã¯ã©ã¦ããµã¼ãã¹ã«ç§»è¡ãã¦ããã®ãè¯ãã ããããããã趣å³ã®éçºã¯æ¥½ããããã©ãã©ãæ©ä¼ãå¢ããã¦ããããã¨ããã