-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtaskServiceAppConsole.js
More file actions
61 lines (50 loc) · 1.48 KB
/
taskServiceAppConsole.js
File metadata and controls
61 lines (50 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
'use strict'
const task = require('./task-service')
const fs = require('fs')
const ts = task.init("http://localhost:9200","tasks/task")
console.log(ts)
var title = "lolllllll"
var description = "bahellllllllllllllllll"
var local = "aliellll"
var generatedId;
ts.insert(title,description,local, (err,res,body) => {
if(err){
return console.error(err)
}
console.log("insert test: \n\n" + JSON.stringify(res) +"\n\n" + JSON.stringify(body) + "\n\n\n")
generatedId = body._id
})
setTimeout(function(){
const id = generatedId
var taskObj = JSON.parse(fs.readFileSync('task1.json', 'utf8'));//'{"title":"lollll222","description":"bahel222","location":"aliel2222"}';
taskObj.id= id
console.log(JSON.stringify(taskObj))
ts.update(taskObj, (err,res,body) => {
if(err){
return console.error(err)
}
console.log("updated test on id "+id+": \n\n" + JSON.stringify(res) +"\n\n" + JSON.stringify(body) + "\n\n\n")
})
},100)
setTimeout(function(){
const id = generatedId
ts.getTask(id,(err,res,body) => {
if(err){
return console.error(err)
}
console.log("getTask test on id "+id+": \n\n" + JSON.stringify(res) +"\n\n" + JSON.stringify(body) + "\n\n\n")
})
},200)
/*
//http://localhost:9200/tasks/task/XXXXXXXXXXXX
setTimeout(function(){
const id = generatedId;
console.log(id + " " + generatedId)
ts.delete(id, (err,res,body) => {
if(err){
return console.error(err)
}
console.log("delete test on id "+id+": \n\n" + JSON.stringify(res) +"\n\n" + JSON.stringify(body) + "\n\n\n")
})
},100)
*/