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 연습" />