Click here to Skip to main content
14,929,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm new in sails.js NodeJs framework.Actually I am building a simple registration and login form.I would like to save the users details in mysql database.
Here is my UserController.js file:

JavaScript
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 Model file model:

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
}
}
};
Posted
Updated 15-Jul-20 22:36pm
v2

1 solution

You have to set the connection of your mysql user into the sails -> config folder
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900