This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var tmp_path = req.files.uploadimgs.path,uuid; | |
| var target_path = './upload/work/'+uuid() +'.png'; | |
| if(req.files) | |
| { | |
| mkdirp(newDir,0777,function(err){ | |
| if(err) throw err; | |
| }) | |
| } | |
| if(req.files) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var uuid=require('node-uuid'); | |
| var tmp_path = req.files.uploadimgs.path,uuid; | |
| console.log(uuid); | |
| // set where the file should actually exists - in this case it is in the "images" directory | |
| var target_path = './upload/work/' +req.files.uploadimgs.name+uuid(); | |
| // move the file from the temporary location to the intended location | |
| fs.rename(tmp_path, target_path, function(err) { | |
| if (err) throw err; | |
| console.log('cfgh'); | |
| // delete the temporary file, so that the explicitly set temporary upload dir does not get filled with unwanted files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var tmp_path = req.files.uploadimgs.path; | |
| // set where the file should actually exists - in this case it is in the "images" directory | |
| var target_path = './upload/work/' + req.files.uploadimgs.name; | |
| // move the file from the temporary location to the intended location | |
| fs.rename(tmp_path, target_path, function(err) { | |
| if (err) throw err; | |
| console.log('cfgh'); | |
| // delete the temporary file, so that the explicitly set temporary upload dir does not get filled with unwanted files | |
| fs.unlink(tmp_path, function() { | |
| if (err) throw err; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Error: .get() requires callback functions but got a [object Undefined] | |
| at Router.route.Route.sensitive (/home/dileep/node_modules/express/lib/router/index.js:252:11) | |
| at Array.forEach (native) | |
| at Router.route (/home/dileep/node_modules/express/lib/router/index.js:248:13) | |
| at Router.methods.forEach.Router.(anonymous function) [as get] (/home/dileep/node_modules/express/lib/router/index.js:270:16) | |
| at Function.methods.forEach.app.(anonymous function) [as get] (/home/dileep/node_modules/express/lib/application.js:412:26) | |
| at Object.<anonymous> (/home/dileep/workspace/erp/app.js:25:5) | |
| at Module._compile (module.js:449:26) | |
| at Object.Module._extensions..js (module.js:467:10) | |
| at Module.load (module.js:356:32) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var express = require('express') | |
| , app = express() | |
| , fs = require('fs'); | |
| // Routes | |
| app.get('/form', function(req, res) | |
| { | |
| fs.readFile('./form.html', function(error, content) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var express = require('express') | |
| , app = express() | |
| , fs = require('fs'); | |
| // Routes | |
| app.get('/form', function(req, res) | |
| { | |
| fs.readFile('./form.html', function(error, content) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var db = require('../lib/db'); | |
| var UserSchema = new db.Schema({ | |
| username : {type: String, unique: true} | |
| , password : String | |
| }) | |
| var MyUser = db.mongoose.model('User', UserSchema); | |
| // Exports | |
| module.exports.addUser = addUser; | |
| // Add user to database | |
| function addUser(username, password, callback) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var mongoose = require('mongoose'); | |
| var Schema = mongoose.Schema; | |
| module.exports.mongoose = mongoose; | |
| module.exports.Schema = Schema; | |
| //Connect to cloud database | |
| var username = "Dileep" | |
| var password ="******"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var http = require('http'); | |
| var querystring = require('querystring'); | |
| var util = require('util'); | |
| http.createServer(function (req, res) { | |
| // set up some routes | |
| switch(req.url) { | |
| case '/': | |
| // show the user a simple form | |
| console.log("[200] " + req.method + " to " + req.url); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var http = require('http'); | |
| http.createServer(function (req, res) { | |
| // set up some routes | |
| switch(req.url) { | |
| case '/': | |
| // show the user a simple form | |
| console.log("[200] " + req.method + " to " + req.url); | |
| res.writeHead(200, "OK", {'Content-Type': 'text/html'}); | |
| res.write('<html><head><link rel="stylesheet" type="text/css" href="style.css"><title>Hello Noder!</title></head><body>'); |