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

)5.- form కӒ੄ ؘ੉ఠܳ ز੸ਵ۽ ઁযೡ ࣻ ੓ח ӝמੑפ׮  ઱۽ "+"9৬ ೣԋ ࢎਊؾפ׮

         ݢ੷ FormData ࢤࢿ੗۽ formData ё୓ܳ ٟ݅פ׮  ׮਺ ௏٘ܳ ೠ ઴ঀ $POTPMF చী ੑ۱೧ࠁࣁਃ




           const	formData	=	new	FormData();
           formData.append('name',	'zerocho');
           formData.append('item',	'orange');
           formData.append('item',	'melon');
           formData.has('item');	//	true
           formData.has('money');	//	false;
           formData.get('item');	//	orange
           formData.getAll('item');	//	['orange',	'melon'];
           formData.append('test',	['hi',	'zero']);
           formData.get('test');	//	hi,	zero
           formData.delete('test');
           formData.get('test');	//	null
           formData.set('item',	'apple');
           formData.getAll('item');	//	['apple'];




         ࢤࢿػ ё୓੄ append ݫࢲ٘۽ ః ч ഋध੄ ؘ੉ఠܳ ੷੢ೡ ࣻ ੓णפ׮  append ݫࢲ٘ܳ ৈ۞ ߣ ࢎਊ೧ࢲ

         ః ೞաী ৈ۞ ѐ੄ чਸ ୶о೧ب ؾפ׮  has ݫࢲ٘ח ઱য૓ ఃী ೧׼ೞח ч੉ ੓ח૑ ৈࠗܳ ঌ݀פ׮  H

         FU ݫࢲ٘ח ઱য૓ ఃী ೧׼ೞח ч ೞաܳ оઉয়Ҋ  getAll ݫࢲ٘ח ೧׼ೞח ݽٚ чਸ оઉ২פ׮  delet
         e ݫࢲ٘ח അ੤ ఃܳ ઁѢೞח ݫࢲ٘Ҋ  set਷ അ੤ ఃܳ ࣻ੿ೞח ݫࢲ٘ੑפ׮


         ੉ઁ axios۽ ಬ ؘ੉ఠܳ ࢲߡী ࠁղݶ ؾפ׮




           (async	()	=>	{
           		try	{
           				const	formData	=	new	FormData();
           				formData.append('name',	'zerocho');
           				formData.append('birth',	1994);
           				const	result	=	await	axios.post('https://www.zerocho.com/api/post/formdata',	formData);
           				console.log(result);
           				console.log(result.data);
           		}	catch	(error)	{
           				console.error(error);
           		}
           })();




         ف ߣ૩ ੋࣻী ؘ੉ఠܳ ֍য ࠁշפ׮  അ੤ ࢸ੿ػ ઱ࣗח पઁ۽ ز੘ೞח ઱ࣗۄࢲ ѾҞчਸ ߉ਸ ࣻ ੓ण
   67   68   69   70   71   72   73   74   75   76   77