-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Meghraj Deshmukh
authored and
Meghraj Deshmukh
committed
Apr 20, 2020
1 parent
2afd40f
commit 72b2b91
Showing
22 changed files
with
1,769 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const Express=require('express'); | ||
var router=require('./router/register'); | ||
var path=require('path'); | ||
var bodyParser = require('body-parser') | ||
var mongoose=require('./config/mongoose'); | ||
|
||
const app=Express(); | ||
//app.use(bodyParser.json()); | ||
app.use(bodyParser.urlencoded({extended: true})); | ||
|
||
app.use(Express.static(path.join(__dirname, 'asset'))); | ||
|
||
app.use('/', router); | ||
|
||
app.listen(2000, function(err){ | ||
|
||
console.log("server starts on"+2000); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,5 +73,12 @@ | |
|
||
|
||
|
||
} | ||
|
||
.form-group{ | ||
|
||
display: flex; | ||
color: black; | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
const mongoose=require('mongoose'); | ||
|
||
mongoose.connect(`mongodb://localhost/DonateCovid`); | ||
|
||
const db=mongoose.connection; | ||
|
||
db.on('error',console.error.bind(console,'error in connecting to Mongodb')); | ||
|
||
db.once('open',function(){ | ||
console.log('Connected to Database:: Mongodb'); | ||
}); | ||
module.exports=db; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
const user=require('../model/user'); | ||
|
||
module.exports.register=function(req, res) | ||
{ | ||
|
||
console.log("on the page of registration"); | ||
console.log(req.body); | ||
|
||
user.create({ | ||
|
||
name:req.body.uname, | ||
phone:req.body.phone, | ||
email:req.body.email, | ||
password:req.body.pswd | ||
|
||
|
||
|
||
}, function(error, user){ | ||
|
||
if(error) | ||
{ | ||
console.log("cannot create user"+error); | ||
res.send(error); | ||
|
||
}else{ | ||
|
||
console.log(user+"Created"); | ||
res.redirect('/userlogin'); | ||
|
||
} | ||
|
||
}) | ||
//res.send("error"); | ||
|
||
|
||
|
||
} | ||
|
||
module.exports.login=function(req,res) | ||
{ | ||
|
||
|
||
|
||
user.find(email=req.body.email, function(err, user){ | ||
|
||
if(err) | ||
{ | ||
res.send(err); | ||
|
||
} | ||
console.log(user); | ||
|
||
if(user.password==req.body.password) | ||
{ | ||
res.redirect('/'); | ||
}else{ | ||
res.send("password doesnt match"); | ||
|
||
} | ||
|
||
|
||
}) | ||
|
||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
const mongoose=require('mongoose'); | ||
|
||
|
||
|
||
//const schema={name:{type:String}} | ||
const adminSchema=mongoose.Schema({ | ||
|
||
name:{ | ||
type:String, | ||
require:true, | ||
}, | ||
|
||
email:{ | ||
type:String, | ||
require:true, | ||
unique:true, | ||
}, | ||
|
||
phone:{ | ||
type:String, | ||
|
||
|
||
}, | ||
password:{ | ||
type:String, | ||
require:true, | ||
|
||
} | ||
|
||
}); | ||
|
||
|
||
const Admin=mongoose.model('Admin',adminSchema); | ||
module.exports=Admin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
const mongoose=require('mongoose'); | ||
|
||
|
||
|
||
//const schema={name:{type:String}} | ||
const userSchema=mongoose.Schema({ | ||
|
||
name:{ | ||
type:String, | ||
require:true, | ||
}, | ||
|
||
email:{ | ||
type:String, | ||
require:true, | ||
unique:true, | ||
}, | ||
|
||
phone:{ | ||
type:String, | ||
|
||
|
||
}, | ||
password:{ | ||
type:String, | ||
require:true, | ||
|
||
} | ||
|
||
}); | ||
|
||
|
||
const User=mongoose.model('User',userSchema); | ||
module.exports=User; |
Oops, something went wrong.