SHARE
TWEET

Untitled

a guest Jan 24th, 2020 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //jshint esversion:6
  2. var express = require('express');
  3. var router = express.Router();
  4.  
  5.  
  6. router.get('/allusers', function(req, res) {
  7.   User.find({}, function(err, FoundUsers) {
  8.     if (err) {
  9.       console.log(err);
  10.     } else {
  11.       if (FoundUsers) {
  12.         res.render("allusers", {
  13.           allusers: FoundUsers,
  14.         });
  15.       }
  16.     }
  17.   });
  18.  
  19. });
  20.  
  21. router.post('/:user', function(req, res) {
  22.   const moduser = req.body.modifyuser;
  23.   console.log(moduser);
  24.   User.find({
  25.     _id: moduser
  26.   }, function(err, user) {
  27.     if (err) {
  28.       console.log(err);
  29.     } else {
  30.       console.log(user);
  31.       res.render("modifyusers", {
  32.         allusers: user,
  33.       });
  34.     }
  35.   });
  36.  
  37. });
  38.  
  39. module.exports = router;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top