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,
},