-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
executable file
·36 lines (30 loc) · 1004 Bytes
/
Copy pathindex.js
File metadata and controls
executable file
·36 lines (30 loc) · 1004 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
34
35
36
#! /usr/bin/env node
var userArgs = process.argv.slice(2);
var searchParam = userArgs[0];
var app = require('./app');
var server = require('http').Server(app);
var io = require('socket.io')(server);
var _ = require('lodash');
var TX = require('./modules/tx'),
Fabric = require('./modules/fabric'),
types = require('./modules/types');
require('dotenv').load();
var fabric = new Fabric();
if (_.indexOf(userArgs, '--start-genesis') >= 0) {
console.log('Creating new genesis transaction');
fabric.attach(new TX());
return;
}
// setInterval(function() { fabric.generateSPAM()}, types.TimePerBlock);
fabric.generateSPAM();
console.log('Listening at port ', process.env.PORT || 18000);
server.listen(process.env.PORT || 18000);
app.get('/', function (req, res) {
res.sendfile(__dirname + '/index.html');
});
io.on('connection', function (socket) {
socket.emit('news', {hello: 'world'});
socket.on('my other event', function (data) {
console.log(data);
});
});