3 var express = require('express'),
4 router = express.Router(),
5 path = require('path'),
8 router.post('', function(req, res) {
9 var dir = req.body.dir,
10 email = req.body.email,
13 if(dir === 'workspace') {
14 dirPath = path.normalize(__dirname+'/../../../workspace/')
16 jb.findOne('user', function(err, documents) {
17 filesInfo = documents.workspaces.map(function(file) {
18 var filePath = dirPath + file
19 var stat = fs.statSync(filePath)
21 stat.isDir = stat.isDirectory()
29 dirPath = path.normalize(__dirname+'/../../../workspace/'+dir.replace('workspace/',''))
30 var files = fs.readdirSync(dirPath)
31 var filesInfo = files.filter(function(file) {
32 return file.substring(0,1) !== '.' && file !== 'preview'
35 var stat = fs.statSync(dirPath+'/'+file)
37 stat.isDir = stat.isDirectory()
44 module.exports = router;