NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

const employee = require('../../model/standup')
const Employee = require('../../model/standup')
// const standup = require('../../model/standup')
module.exports = function(router){


// post data
router.post('/employee', function (req,res){
let note = new Employee(req.body)
note.save(function (err,note){
if(err){
return res.status(400).json(err)
}
res.status(200).json(note)
})
})

//get data which we posted

router.get('/employee',function(req,res){
Employee.find({},(err,employee)=>{
if(err){
res.json({success:false, message :err});
}else{
if(!employee){
res.json({success:false, message:'no standup found'});
}
else{
//res.json({success:true,standup:standup});
res.json(employee)

}
}
})
})

//specific get
router.get('/employee/:_id', async(req,res)=>{
try{
const post = await Employee.findById(req.params._id);
res.json(post);
}
catch(err){
res.json({message:err});
}
})
//update data which we posted put verb

router.put('/updateEmployee/:_id',(req,res)=>{
// check if id was provided
if(!req.body._id){
res.json({success:false,message:'No standup id provided'}); //return error message
}else{
//check if it's exist in database
Employee.findOne({_id:req.body._id},(err,employee)=>{
//check if id is a valid ID
if(err){
res.json({success:false,message:'not a valid standupid'});
} else{
employee.employeeId= req.body.employeeId;
employee.firstName= req.body.firstName;
employee.lastName = req.body.lastName;
employee.address = req.body.address;
employee.phoneNumber = req.body.phoneNumber;
employee.location = req.body.location;

employee.save((err) => {
if(err){
res.json({success:false,message:err});
}else{
res.json({success:true,message :'standup updated'});
}
})
}
}
)
}
})

// delete data

router.delete('/deleteemployee/:_id',(req,res) => {
//check if id was provided in parameters
if(!req.params._id){
res.json({ success:false,message:'No id provided'}); //return error message
} else {
//check id id is found in database
Employee.findOne({id: req.params.id},(err,employee) => {
//check if error was found
if (err) {
res.json({success:false,message:'Invalid id'}); // return error message
} else {
//remove the standup from database
employee.remove((err) => {
if(err) {
res.json({ success: false,message:err}); //return error message
} else{
res.json({success:true,message:'Standup deleted!'}); //return success message
}
});
}
});
}
});

}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.