-1
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.post('/upload', function (req, res) {
console.log('hari :'+req.body.purpose);
timeNow = Date.now();
var jobID = timeNow + '_' + Math.floor((Math.random() * 10000000000000) + 1);
var rethinkObj = config.rethinkdb;
var data = {
"id": jobID,
"finished_at": timeNow,
"last_update": timeNow,
"log": "add job",
"process_instructions": "",
"start_at": timeNow,
"status": "in-progress"
}
rethink.insertDataIntoTable(rethinkObj, data).then(function(insertedData){
console.log(insertedData);
console.log('new row inserted into RethinkDB', data.id);
uploadFile(req, res, jobID);
})
});