 router = express.Router()
 passport = require 'passport'
 _ = require 'lodash'
+users = require '../users'
 
 router.use (req, res, next) ->
   if !req.user

    res.redirect "/"
  else
    next()

router.get "/getUser", (req, res) ->
  res.json _.omit req.user, 'password'

router.get '/name', (req, res) ->
  res.json data: req.user.username

router.get '/files', (req, res) ->
  res.json data: req.user.slides

router.use (req, res, next) ->
  if !req.user.admin

  else
    next()

router.get '/getUsers', (req, res) ->
  res.respond users.getUsers()

module.exports = router