-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexampleServer.js
More file actions
37 lines (28 loc) · 816 Bytes
/
exampleServer.js
File metadata and controls
37 lines (28 loc) · 816 Bytes
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
var request = require("request");
var express=require('express');
var app=express();
var server=require('http').createServer(app);
var reader = require('./my_modules/excelReader/Reader');
var port = 3010;
server.listen(port,function(){
console.log("server is running on port: ",port);
});
var excel = new reader.ExcelReader('data/spam.csv');
var seconds = 25;
var the_interval = 10000;
setInterval(function() {
var res = excel.getPerTime(seconds);
if (res){
var data = JSON.stringify(res);
console.log(data);
request({
uri: "http://localhost:3000/harvest",
method: "POST",
form: {
data: data
},
}, function(error, response, body) {
console.log(body);
});
}
}, the_interval);