]> git.immae.eu Git - perso/Immae/Projets/Nodejs/Surfer.git/commitdiff
Fix delete
authorJohannes Zellner <johannes@nebulon.de>
Sat, 27 Jun 2015 13:41:43 +0000 (15:41 +0200)
committerJohannes Zellner <johannes@nebulon.de>
Sat, 27 Jun 2015 13:41:43 +0000 (15:41 +0200)
files/foobar [deleted file]
src/files.js

diff --git a/files/foobar b/files/foobar
deleted file mode 100644 (file)
index cf08457..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-{
-  "name": "surfer",
-  "version": "1.0.0",
-  "description": "Simple file server",
-  "main": "app.js",
-  "scripts": {
-    "test": "echo \"Error: no test specified\" && exit 1"
-  },
-  "keywords": [
-    "file",
-    "server"
-  ],
-  "author": "Johannes Zellner <johannes@nebulon.de>",
-  "license": "MIT",
-  "dependencies": {
-    "body-parser": "^1.13.1",
-    "compression": "^1.5.0",
-    "connect-lastmile": "0.0.10",
-    "connect-timeout": "^1.6.2",
-    "ejs": "^2.3.1",
-    "express": "^4.12.4",
-    "morgan": "^1.6.0",
-    "multiparty": "^4.1.2",
-    "rimraf": "^2.4.0"
-  }
-}
index fd9c8fde19d1a5f70f2191ecdb4d4a1ece1b52da..55e8978ac59908b78a5ffbac2ea2b40e7b76f69c 100644 (file)
@@ -62,7 +62,7 @@ function get(req, res, next) {
     fs.stat(absoluteFilePath, function (error, result) {
         if (error) return next(new HttpError(404, error));
 
-        console.log('get', absoluteFilePath, result);
+        console.log('get', absoluteFilePath);
 
         if (result.isFile()) return res.sendfile(absoluteFilePath);
         if (result.isDirectory()) return res.status(200).send({ entries: fs.readdirSync(absoluteFilePath) });
@@ -82,7 +82,7 @@ function put(req, res, next) {
     fs.stat(absoluteFilePath, function (error, result) {
         if (error && error.code !== 'ENOENT') return next(new HttpError(500, error));
 
-        console.log('put', absoluteFilePath, result, req.files.file);
+        console.log('put', absoluteFilePath, req.files.file);
 
         if (result && result.isDirectory()) return next(new HttpError(409, 'cannot put on directories'));
         if (!result || result.isFile()) {
@@ -106,7 +106,7 @@ function del(req, res, next) {
 
         rimraf(absoluteFilePath, function (error) {
             if (error) return next(new HttpError(500, 'Unable to remove'));
-            next(new HttpError(200, {}));
+            next(new HttpSuccess(200, {}));
         });
     });
 }