-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from harshjain777/main
adding server
- Loading branch information
Showing
1,855 changed files
with
298,740 additions
and
4 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
Binary file not shown.
Empty file.
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,30 @@ | ||
const Contact = require('../models/contact.model.js') | ||
|
||
const contactUser = async(req,res)=>{ | ||
const {userName,email,description} = req.body; | ||
|
||
try { | ||
|
||
const newContact = new Contact({ | ||
userName, | ||
email, | ||
description | ||
}) | ||
await newContact.save(); | ||
|
||
res.status(200).json({ | ||
success:true, | ||
message:"message sent successfully" | ||
}) | ||
|
||
} catch (error) { | ||
console.log(error); | ||
res.status(500).json({ | ||
success:false, | ||
message:'error while sending message' | ||
}) | ||
|
||
} | ||
} | ||
|
||
module.exports = {contactUser} |
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 mongoose = require('mongoose') | ||
|
||
const ContactSchema = new mongoose.Schema({ | ||
userName:{ | ||
type:String, | ||
required:true | ||
}, | ||
email:{ | ||
type:String, | ||
required:true | ||
}, | ||
description:{ | ||
type:String, | ||
required:true | ||
} | ||
}); | ||
|
||
const Contact = mongoose.model('Contact',ContactSchema) | ||
module.exports = Contact; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.