OSDN Git Service

Modified: Upload, Command execution
[eos/zephyr.git] / server / api / dirCreation / index.js
1 'use strict';
2
3 var express = require('express'),
4     router  = express.Router(),
5     path = require('path'),
6     fs = require('fs');
7
8 router.post('/', function(req, res) {
9     var dir = req.body.dir,
10         email = req.body.email,
11         name = req.body.createdDirName,
12         createdDirPath = path.normalize(__dirname+'/../../../'+dir+'/'+name)
13     
14     try {
15         fs.mkdirSync(createdDirPath)
16         res.send('dirCreation success')
17     } catch(e) {
18         res.sendStatus(409)
19     }
20
21     if(dir === 'workspace') {
22       /*(
23         jb.update('user',
24                 { email: email ,
25                 $addToSet: { workspaces: name }
26                 })
27     */
28     }
29
30
31 });
32
33 module.exports = router;