sails.js NodeJs 프레임 워크에서 새로 생겼습니다. 실제로 간단한 등록과 로그인 양식을 만들고 있습니다. 사용자 세부 정보를 mysql 데이터베이스에 저장하고 싶습니다.sails.js를 사용하여 mysql에 데이터를 저장하십시오.
module.exports = {
'registration': function(req,res){
res.view();
},
create: function(req,res,next){
user.create(req.params.all(), function userCreated(err,user){
if(err){
return next(err);
}
else{
}
});
}
}
의 user.js 모델 파일 모델 : 등록 따옴표없이 그래서
module.exports = {
attributes: {
name:{
type: 'string',
required: true
},
title:{
type: 'string',
required: true
},
email:{
type: 'string',
email: true,
required: true,
unique: true
},
encryptedPassword:{
type: 'string',
required: true
}
}
};
무엇이 질문입니까? – Meeker
사실 나는 사용자 컨트롤러와 사용자 model.I가 RESTFULL JSON API.i를 사용하고 싶지 않아요 양식에서 모든 데이터를 가져 와서 MySQL 데이터베이스에 저장 싶어요. 덕분에 –