Skip to content

Instantly share code, notes, and snippets.

@JelaniThompson
Created November 7, 2016 00:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JelaniThompson/9460da845900657ef969450e5eca44de to your computer and use it in GitHub Desktop.
Save JelaniThompson/9460da845900657ef969450e5eca44de to your computer and use it in GitHub Desktop.
db.once('open', function() {
let UserSchema = mongoose.Schema({
username: String,
password: String
})
let User = mongoose.model('User', UserSchema)
app.post('/signup', urlencodedParser, function(req, res) {
username = req.body.username,
password = req.body.password,
salt = bcrypt.genSaltSync(10),
hash = bcrypt.hashSync(password, salt)
// Trying to assign a variable name to the constructor below
new User({ username: username, password: hash })
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment