Posts

Showing posts from July, 2017

Uplaod to Firebase Storage from Node Express REST

Image
I need to upload user profile picture from mobile device trogh rest API to Firebase storage .Finally I go the follwing articale wich really guide me .  https://mzmuse.com/blog/how-to-upload-to-firebase-storage-in-node In order to upload the file from Express REST I used connect-busboy and fs node modules . Route file   router.post('/api/user-pic/profile-type/:type', ProfilePicController.setProfile); Controller File    exports.setProfile = function(req, res, next) {                     var fstream;                     req.pipe(req.busboy);                     req.busboy.on('file', function (fieldname, file, filename) {                                           console.log("Uploading: " + filename);                         fstream = fs.createWriteStream(__dirname + '/files/' + filename);                               file.pipe(fstream);                         const filePath = __dirname + '/files/' + filename;  

Node Express REST API Document while coding

I have used apidoc in my  Node Express REST Project . It works like charm and cpable to handle document versioning. APIDOC Inline Documentation for RESTful web APIs http://apidocjs.com/#param-api-description 1.npm install apidoc - g 2. /** * @api {get} /tasks/:id Find a task * @apiGroup Tasks * @apiDescription User login + register user if user login for the frist time. * @apiParam {id} id Task id * @apiSuccess {Number} id Task id * @apiSuccess {String} title Task title * @apiSuccess {Boolean} done Task is done? * @apiSuccess {Date} updated_at Update's date * @apiSuccess {Date} created_at Register's date * @apiSuccessExample {json} Success * HTTP/1.1 200 OK * { * "id": 1, * "title": "Study", * "done": false * "updated_at": "2016-02-10T15:46:51.778Z", * "created_at": "2016-02-10T15:46:51.778Z" * } * @apiErrorExample {json} Task not f

ENOENT: no such file or directory, rename : node_modules/async

Image
I have gone trough follwing error ,when I was updating npm. npm ERR! path /Users/interlectivethree/firebase/fetchme/server/node_modules/winston/node_modules/async npm ERR! code ENOENT npm ERR! errno -2 npm ERR! syscall rename npm ERR! enoent ENOENT: no such file or directory, rename '/Users/interlectivethree/firebase/fetchme/server/node_modules/winston/node_modules/async' -> '/Users/interlectivethree/firebase/fetchme/server/node_modules/winston/node_modules/.async.DELETE' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent npm ERR! A complete log of this run can be found in: npm ERR!     /Users/interlectivethree/.npm/_logs/2017-07-07T14_17_29_016Z-debug.log I have done sevarel things like package wise unstall and install ,package relocating .But no success .But I think compleate unstall and reinstall is the best option and follwing commands used. npm uninstall ` ls - 1 node_modules | tr '/\n' ' &#