Page 242 - Nodejs 교과서 개정2판
P. 242

alert(message);
                                                               </script>




          
                 ߸ࣻ

         )5.-җ ׮ܰѱ ੗߄झ௼݀౟ ߸ࣻܳ మ೒݁ী ۪؊݂ೡ ࣻ ੓णפ׮  res.render ഐ୹ द ࠁղח ߸ࣻܳ ಌӒ
         о ୊ܻ೤פ׮  SPVUFT JOEFY KT੄ ௏٘ܳ ࠁݶ ׮਺ ࠗ࠙੉ ੓णפ׮




           router.get('/',	function(req,	res,	next)	{
           		res.render('index',	{	title:	'Express'	});
           });




         res.render 템플릿,	변수	객체)ח ੊झ೐ۨझо res ё୓ী ୶оೠ మ೒݁ ۪؊݂ਸ ਤೠ ݫࢲ٘ੑפ׮  JOE

         FY QVHܳ )5.-۽ ۪؊݂ೞݶࢲ { title:	'Express'	}ۄח ё୓ܳ ߸ࣻ۽ ૘য֍णפ׮  MBZPVU QVH৬ JOE

         FY QVH੄ title ࠗ࠙੉ ݽف Express۽ ஖ജؾפ׮  ૊  )5.-ীب ߸ࣻܳ ࢎਊೡ ࣻ ੓ѱ ػ ࣅੑפ׮

         res.render ݫࢲ٘ী ف ߣ૩ ੋࣻ۽ ߸ࣻ ё୓ܳ ֍ח ؀न  res.locals ё୓ܳ ࢎਊ೧ࢲ ߸ࣻܳ ֍ਸ ࣻب ੓

         णפ׮




           router.get('/',	function(req,	res,	next)	{
           		res.locals.title	=	'Express';
           		res.render('index');
           });




         ਤ৬ э੉ ೞݶ మ೒݁ ূ૓੉ res.locals ё୓ܳ ੍যࢲ ߸ࣻܳ ૘য ֍णפ׮  ੉ ߑध੄ ੢੼਷ അ੤ ۄ਋ఠ
         ࡺ݅ ইפۄ ׮ܲ ޷ٜਝযীࢲب res.locals ё୓ী ੽Ӕೡ ࣻ ੓׮ח Ѫੑפ׮  ٮۄࢲ ׮ܲ ޷ٜਝযীࢲ మ

         ೒݁ ূ૓ਊ ߸ࣻܳ ޷ܻ ֍ਸ ࣻب ੓णפ׮

         ੉ઁ ಌӒীࢲ ߸ࣻܳ ࢎਊೞח ߑߨਸ ࢓ಝࠇद׮


                                  ಌӒ                                                  )5.-

           h1=	title                                           <h1>Express</h1>
           p	Welcome	to	#{title}                               <p>Welcome	to	Express</p>

           button(class=title,	type='submit')	전송               <button	class="Express"	type="submit">전송</butt
           input(placeholder=title	+	'	연습')                    on>
                                                               <input	placeholder="Express	연습"	/>
   237   238   239   240   241   242   243   244   245   246   247