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

$	npm	start
           >	learn-sequelize@0.0.1	start	C:\Users\zerocho\learn-sequelize
           >	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`
           3001	번	포트에서	대기	중
           Executing	(default):	SELECT	1+1	AS	result
           데이터베이스	연결	성공




         ݃૑݄ ف ۽Ӓо ڰݶ োѾ੉ ࢿҕೠ Ѫੑפ׮  োѾী पಁೠ ҃਋ ী۞ ݫद૑о ۽Ӧؾפ׮  ী۞ח ઱۽ .Z
         42- ؘ੉ఠ߬੉झܳ प೯ೞ૑ ঋওѢա  ࠺޻ߣഐо ౣ۷Ѣա  ࢸ੿ ౵ੌਸ ੜޅ ࠛ۞৳ਸ ٸ ߊࢤ೤פ׮

          
          
               ݽ؛ ੿੄ೞӝ

         ੉ઁ .Z42-ীࢲ ੿੄ೠ ప੉࠶ਸ द௬ۄ੉ૉীࢲب ੿੄೧ঠ ೤פ׮  .Z42-੄ ప੉࠶਷ द௬ۄ੉ૉ੄ ݽ؛
         җ ؀਽ؾפ׮  द௬ۄ੉ૉח ݽ؛җ .Z42-੄ ప੉࠶ਸ োѾ೧઱ח ৉ೡਸ ೤פ׮  6TFS৬ $PNNFOU ݽ؛ਸ

         ٜ݅য VTFST ప੉࠶җ DPNNFOUT ప੉࠶ী োѾ೧ࠇद׮  द௬ۄ੉ૉח ӝࠄ੸ਵ۽ ݽ؛ ੉ܴ਷ ױࣻഋਵ۽
         ప੉࠶ ੉ܴ਷ ࠂࣻഋਵ۽ ࢎਊ೤פ׮

          models/user.js

           const	Sequelize	=	require('sequelize');


           module.exports	=	class	User	extends	Sequelize.Model	{
           		static	init(sequelize)	{
           				return	super.init({
           						name:	{
           								type:	Sequelize.STRING(20),
           								allowNull:	false,
           								unique:	true,
           						},
           						age:	{
           								type:	Sequelize.INTEGER.UNSIGNED,
           								allowNull:	false,
           						},
           						married:	{
           								type:	Sequelize.BOOLEAN,
           								allowNull:	false,
           						},
   298   299   300   301   302   303   304   305   306   307   308