Node.jsãProgateð£Node.js â ïŒ3ç« ããŒãžã衚瀺ãããïŒã
ç®æš1h40ïœãªãšãããæ¢ã«1ïœ10ïœçµéããããŠãä»åãæ®éã«1ïœè¶
ããæ°ãããïŒã¡ããã¡ããåŠç¿ã ã£ãïŒããã®ããããðððððãªãæèåæ¢ãå€ãã£ãã
ð£ããŒãžã®è¡šç€ºã®ä»çµã¿
ð£CSSã®é©çšãšç»åã®è¡šç€º
ð£äžèŠ§ç»é¢ã®äœæ
ãð£ããŒãžã®è¡šç€ºã®ä»çµã¿ã
ðžã«ãŒãã£ã³ã°
ãâURLã«å¯Ÿå¿ããåŠçãå®è¡ããããš
âïŒïŒå ã«ãïŒreq , resïŒãå ¥ãã
ðžãã¥ãŒãã¡ã€ã«ïŒEJSïŒ
ãâãããç»é¢ã®èŠãç®ãäœããã¡ã€ã«ã®ããš
ðžres.render
ãâæå®ãããã¥ãŒãã¡ã€ã«ããã©ãŠã¶ã«è¡šç€ºãã
â»æ¬æ¥ã¯ã³ãŒãå€æŽã®åºŠã«ãµãŒããŒãåèµ·åãã
ãã¹ãŒâŠå
šç¶åãããªãð±ã£ãŠããèªåã§äœ¿ãããªããæããå
šãããªã⊠ãŸã éäžã ãããããâŠãå±±ã®å
šäœåãæŽãããäžçãèŠããŠããã®ãããâŠãµã麩麩麩âŠäžå®âŠ
ãð£CSSã®é©çšãšç»åã®è¡šç€ºã
ðžCSSã®é©çš
ãâExpressã§ã¯ãCSSãç»åãã¡ã€ã«ãã©ãã«çœ®ãããŠãããïŒïŒãæå®ããå¿
èŠãããããããã©ã«ããäœæããŠãã¡ã€ã«ãäœã£ãŠããã
â ãapp.jsãã«ãŠãæ°ããäœæãããã©ã«ãã®æå®
â ïžãstaticãã«ã€ããŠ
â¡CSSãã¡ã€ã«ã®äœæ
â¢EJSãã¡ã€ã«å
ïŒãããç»é¢ïŒã«ããã®ã·ãŒãã®ãã¹ãæå®
ðžç»åã䜿ã
ãâEJSãã¡ã€ã«å
ã§ãåæ§ã«ãã·ãŒãã®ãã¹ãæå®ã
ãð£äžèŠ§ç»é¢ã®äœæã
ãlocalhost:3000/indexã«ã¢ã¯ã»ã¹ããæã«ãäžèŠ§ç»é¢ã衚瀺ãããããã«åŠçããã
â app.jså
ã«ãURLã«å¯Ÿå¿ããã«ãŒãã£ã³ã°ãçšæ
â¡ã«ãŒãã£ã³ã°ã®åŠçã®äžã§è¡šç€ºãããã¥ãŒãã¡ã€ã«ãæå®
â¢äžèŠ§ç»é¢çšã®ãã¥ãŒãã¡ã€ã«ãäœæ
ããŸãšãã
htmlãªãCSSã®ã³ãŒãããæºåããã ããŠããäžã§ã®æŒç¿ãªã®ã§ãæãé£ãã§ããããŸã ãŸã èªåã®åã«ã¯ãªã£ãŠããªãäºãå€ãããšå®æããæ¥ã
ã§ããå°å³ã§ãåçŽã§ããç¹°ãè¿ãç¹°ãè¿ãã埩ç¿ããŠããããã§ããæéãå
šç¶è¶³ããªãããããªããã工倫ã§ããªãããªâŠãšèãããããåŠãæ¥ã
ã§ãð
ãã®èšäºãæ°ã«å ¥ã£ãããµããŒããããŠã¿ãŸãããïŒ