-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
103 lines (53 loc) · 1.33 KB
/
server.js
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
var express = require('express');
var path = require ('path');
var bodyParser = require('body-parser');
var app = express();
var http = require('http').Server(app);
var io = require('socket.io')(http);
/*
var difficulty =""
, extraData =""
, gasLimit=""
, gasUsed=""
, hash=""
, logsBloom=""
, miner=""
, mixHash=""
, nonce=""
, number=""
, parentHash=""
receiptRoot=""
, sha3Uncles=""
, size=""
, stateRoot=""
, timestamp=""
, totalDifficulty=""
, transactions=[]
, transactionsRoot=""
, uncles =[];
*/
var index = require('./routes/index');
var api = require ('./routes/api');
//view engine
app.set('views', path.join(__dirname,'views'));
app.set('view engine','ejs');
app.engine('html', require('ejs').renderFile);
app.use(express.static(path.join(__dirname, 'client')));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false}));
app.use('/',index);
app.use('/api/', api.router);
//var msg = " woooooork pleaaaaaaaaaaaaaase ";
var block = {
"Difficulty": "147852" ,
"Hash": "123456789azertyuio123",
"Transactions": ["tx1","tx2","tx3"]
}
io.on('connection', function(socket){
console.log("pouuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuff");
api.myFunction(io);
});
;
http.listen(3001, function(){
console.log("server started at port 3001 .....");
});