node.js - Error: Can't set headers after they are sent on post request, why? -
any time added validation schema , try make post request following error message:
error: can't set headers after sent.
var playerschema = new schema({ firstname: { type: string, require: true, required: 'first name required' }, lastname: { type: string, require: true, required: 'last name required' }, nickname: { type: string, trim: true }, mentor: { type: string, trim: true }, clubname: { type: string, trim: true }, created_at: { type: date, default: date.now }, updated_at: { type: date, default: date.now }, email: { type: string, trim: true, unique: true, required: 'email address required', validate: [validateemail, 'please fill valid email address'], match: [/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/, 'please fill valid email address'] }, phonenumber: { type: string, unique: true, required: 'phone number required', } });
Comments
Post a Comment