æ¥è¨ãæ¸ããã·ã¹ãã ãæ¸ãã。
絶対åããããªãã®ãããã ãããã©、ããããæ¢ããã、ãããæ°ã«é£ããªããªã¨æããªãã使ãã®ãã ããã®ã§、èªä½ãã。æ¡ä»¶ã¨ãã¦ã¯、æ¥è¨ãæ¸ã以å¤ã®æ©è½ããªãã¦、ç¹ã«éãããããªãã¦、ã©ãããã§ãã¢ã¯ã»ã¹ã§ãã¦(ãã¼ã«ã«ã«éå®ãããªãã¦)、ã§ããã°ããã¾ãè½ã¡ããããªãã¦、ä¿å®ã«ãéçºã«ãæéãããããªãã¨ãããã¨ã 。
ã¨ããããã§、firebaseã¨AWSã®S3ã使ã£ã¦、ãµã¼ãã¼å´ã®ã³ã¼ããæ¸ããã«ä½ã£ã。firebaseã¯èªè¨¼ã¨ãã¡ãã£ã¨ããjsonä¿åã§ãããªã¢ã«ã¿ã¤ã ãã¼ã¿ãã¼ã¹ãªãããæä¾ãã¦ãããMBaaS(Mobile backend as a service)ã§、ç¾ç¶ã¯Googleåä¸ã«ãªã£ã¦ãã¯ã。帯åã¨ãªã¯ã¨ã¹ãæ°ã¨ãã«å¶éãããã£ã¦ã¦、課éããã¨è±ªè¯ã«ãªã£ã¦ãããã©、èªåã ãã使ãã·ã¹ãã ãªãç¡æã§ä½è£ã 。
S3ã¯AWSã®ã¹ãã¬ã¼ã¸ãµã¼ãã¹ã§éçWebãã¹ãã£ã³ã°ãã¤ãã¦ã¦、ã¹ã¿ãã£ãã¯ãªãã¡ã¤ã«ãå
ç¢ãã¤ããããã¢ã¯ã»ã¹ãã£ã¦ãåé¡ãªãã£ãããã。ããã1GBãããã§ç´æ3å(転ééã¨ãã§ä»ã«ããããã©、èªåã ããªãåé¡ãªã)。èªä½ã®é©å½ã«ä½ã£ãã²ã¼ã 群ãå
¨é¨ããã«ç½®ãã¦ãã。è¦éããã£ãã¼ããã¨ãã¼ã«æ²è¼ãããã¨ãã¨ããããªãã«ã¢ã¯ã»ã¹ãéä¸ããã®ã ãã©、ç¹ã«é
延çãçºçãã¦ãªãã£ãã¯ã。ã¡ãªã¿ã«è»¢ééã¯ãã®ã¨ãã¯æ²è¼ããæ°æ¥ã§ã³ãã³ãã§ï¼ï¼ï¼åãããã¯ããã£ã。
ã§、S3ã«ã¹ã¿ãã£ãã¯ãªãã¼ã¸ãç½®ãã¦、ããããfirebaseã®èªè¨¼ã¨DBã«æ¥ç¶ããã°、ãµã¼ãã¼å´ã®ã³ã¼ããæ¸ããã«éããããã使ããã¨ãããã。firebaseã¯èªè¨¼ãããã¤ãã¨ãã¦Googleã¨ãã使ãã¦、ããããä¾çµ¦ãããã¦ã¼ã¶ã¼IDãfirebaseã®DBã®ã¢ã¯ã»ã¹æ¨©éã«è¨å®ã§ãã。ãªã®ã§、èªåã®ã¦ã¼ã¶ã¼ID以å¤ã¯ä¸åæ¸ãè¾¼ã¿ãèªã¿è¾¼ã¿ãåºæ¥ãªãè¨å®ã«ãã¦ããã°、firebaseãGoogleå´ã«åé¡ããªãéã、ã»ãã¥ãªãã£ãåé¡ãªã。
Webã®ããã³ãã¨ã³ãã¯Vue.jsã¨vuexã使ã£ã。ãã®è¾ºã®èª¬æã¯ã·ã³ãã«ã«ã§ããããªæããããªãã®ã§çç¥ãã。ã¡ãªã¿ã«Vue.jsã«ã¯å
¬å¼ã§firebaseã¨é£æºããVueFireã¨ããã¢ã¸ã¥ã¼ã«ãå
¬éããã¦ããã、vuexã使ããªãç¹ã«å¿
è¦ãªããããªã®ã§æ¡ç¨ããªãã£ã。vuexã®READMEã«ããéã、Actionsã®ä¸ã§firebaseãå¼ãã§ãã®çµéãçµæã«å¿ãã¦Mutationså¼ã¹ã°è¯ãã ãã 。
ç°å¢æ§ç¯ã¯vue-cliã®webpackãã³ãã¬ã¼ãã使ã£ã。ããã§ä½¿ãã¨ç¹ã«ä½ãèããªãã¦ãããããªãã¼ãä»ãã®ãã¼ã«ã«ãµã¼ãã¼ãä¸ããã®ã§æ¥½ã ã£ã。S3ã¸ã®ãã¡ã¤ã«è»¢éã¯é¢åãããã®ã§ãããã¤ã¹ã¯ãªãããæ¸ãã。node-s3-clientã§uploadDirã使ãã¨、ãã£ã¬ã¯ããªæå®ããã¨åé¤ãã¡ã¤ã«ã¯ã¡ããã¨æ¶ãã¦ããã£ã¨ä¸ãã¦ãããã®ã§、ããã¾ã楽ã ã£ã。
ããã§ãããªæãã«ãªã£ã。æºè¶³。
ã¡ãªã¿ã«pushStateã使ã£ãURL移åãããSPAãªã®ã§、ãªãã¼ãããã¨ãã«åå¨ããªããã¡ã¤ã«ã¸ã®ãªã¯ã¨ã¹ããé£ã¶ãã¨ã«ãªã。ããã¯æ®éã«Apacheã¨ã使ã£ã¦ãå ´å、htaccessã¨ãã«index.htmlã¸ã®ãªãã¤ã¬ã¯ããæ¸ãããããããããã ãã©、S3ãå©ç¨ãã¦ããã®ã§、ã¨ã©ã¼ããã¥ã¡ã³ãã«ãindex.htmlãæ¸ããã¨ã§èª¤éåãã¦ã¿ã。
HTTPã¹ãã¼ã¿ã¹ã³ã¼ãã404ãªã®ã§ããªãã¢ã¬ãªæããããã、èªåã®ãã®ãªã®ã§ã¾ãå¥ã«è¯ãããªã¨ããæã。ä»äºã§ãããªãæµç³ã«ããã¯ã¢ã¬ãªã®ã§、S3ã®ãã¹ãã£ã³ã°ãåã£ã¦CloudFrontããå©ç¨ãã¦、ããã®ã«ã¹ã¿ã ã¨ã©ã¼ããã¥ã¡ã³ãã使ãã°å¥½ããªã¹ãã¼ã¿ã¹ã³ã¼ããè¿ããã®ã§ããã¡ããã¹ãã¼ãã ãã。ããã«ãããªãã¿ãã§HTTPSã使ãã。
*
ã¢ãã«
売ãä¸ãã©ã³ãã³ã°: 222