Skip to content

Commit

Permalink
Delete spaces in code
Browse files Browse the repository at this point in the history
  • Loading branch information
gsnada committed Apr 27, 2018
1 parent b149d0a commit d232907
Show file tree
Hide file tree
Showing 5 changed files with 238 additions and 74 deletions.
20 changes: 1 addition & 19 deletions database-mongo/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
var bcrypt=require('bcrypt-nodejs');
var mongoose = require('mongoose');


//set mongoose connection
//mongoose.connect('mongodb://localhost/doctors');

mongoose.connect('mongodb://dazzel:[email protected]:55329/doctorsdb');


var db = mongoose.connection;

db.on('error', function() {
Expand Down Expand Up @@ -42,16 +40,13 @@ var doctorsSchema = mongoose.Schema({

var Doctor = mongoose.model('Doctor', doctorsSchema);



var userSchema = mongoose.Schema({
username: {
type:String,
unique:true},
password: String
});


// user password encryption
userSchema.methods.encryptPassword=function(password){
return bcrypt.hashSync(password,bcrypt.genSaltSync(10));
Expand All @@ -63,18 +58,5 @@ userSchema.methods.validPassword=function(password){
}
var User = mongoose.model('User',userSchema);


// to retrive all doctors
var selectAll = function(callback) {
Doctor.find({}, function(err, doctor) {
if(err) {
callback(err, null);
} else {
callback(null, Doctor);
}
});
};

module.exports.selectAll = selectAll;
module.exports.Doctor=Doctor;
module.exports.User = User;
Loading

0 comments on commit d232907

Please sign in to comment.