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

});




         &YQSFTT ݽٕਸ प೯೧ app ߸ࣻী ೡ׼೤פ׮  ੊झ೐ۨझ ղࠗী IUUQ ݽٕ੉ ղ੢غয ੓ਵ޲۽ ࢲߡ੄ ৉ೡ
         ਸ ೡ ࣻ ੓णפ׮


         app.set('port',	포트)۽ ࢲߡо प೯ؼ ನ౟ܳ ࢸ੿೤פ׮  process.env ё୓ী PORT ࣘࢿ੉ ੓׮ݶ Ӓ чਸ
         ࢎਊೞҊ  হ׮ݶ ӝࠄчਵ۽     ߣ ನ౟ܳ ੉ਊೞب۾ غয ੓णפ׮  ੉ۧѱ app.set(키,	값)ਸ ࢎਊ೧ࢲ

         ؘ੉ఠܳ ੷੢ೡ ࣻ ੓णפ׮  ա઺ী ؘ੉ఠܳ app.get(키)۽ оઉৢ ࣻ ੓णפ׮


         app.get(주소,	라우터)ח ઱ࣗী ؀ೠ (&5 ਃ୒੉ ৢ ٸ যڃ ز੘ਸ ೡ૑ ੸ח ࠗ࠙ੑפ׮  ݒѐ߸ࣻ reqח
         ਃ୒ী ҙೠ ੿ࠁо ٜয ੓ח ё୓੉Ҋ  resח ਽׹ী ҙೠ ੿ࠁо ٜয ੓ח ё୓ੑפ׮  അ੤ GET / ਃ୒ द

         ਽׹ਵ۽ Hello, Expressܳ ੹࣠೤פ׮  ੊झ೐ۨझীࢲח res.writeա res.end ؀न res.sendܳ ࢎਊೞݶ
         ؾפ׮


         GET ਃ୒ ৻ীب POST  PUT  PATCH  DELETE  OPTIONSী ؀ೠ ۄ਋ఠܳ ਤೠ app.post  app.put  app.patch  ap
         p.delete  app.options ݫࢲ٘о ઓ੤೤פ׮


         listenਸ ೞח ࠗ࠙਷ IUUQ ਢ ࢲߡ৬ زੌ೤פ׮   ੢ীࢲ ࢲߡܳ ҳز೮؍ Ѫҗ زੌೞѱ ನ౟ܳ োѾೞҊ ࢲ
         ߡܳ प೯೤פ׮  ನ౟ח app.get('port')۽ оઉ৳णפ׮


          콘솔
           $	npm	start
           >	learn-express@0.0.1	start	C:\Users\zerocho\learn-express
           >	nodemon	app


           [nodemon]	2.0.3
           [nodemon]	to	restart	at	any	time,	enter	`rs`
           [nodemon]	watching	dir(s):	*.*
           [nodemon]	watching	extensions:	js,mjs,json
           [nodemon]	starting	`node	app.js`
           3000	번	포트에서	대기	중




         IUUQ   MPDBMIPTU     ਵ۽ ੽ࣘೞݶ ׮਺җ э਷ ಕ੉૑о ڴ Ѫੑפ׮
   207   208   209   210   211   212   213   214   215   216   217