forked from poanetwork/poa-faucet
-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
43 lines (35 loc) · 1.25 KB
/
index.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
var express = require('express');
var fs = require('fs');
var https = require('https');
var bodyParser = require('body-parser');
var querystring = require('querystring');
var Web3 = require('web3');
var EthereumTx = require('ethereumjs-tx');
var app = express();
app.fs = fs;
app.https = https;
app.querystring = querystring;
app.Web3 = Web3;
app.EthereumTx = EthereumTx;
var config;
var configPath = './config.json';
var configExists = fs.existsSync(configPath, fs.F_OK);
if (configExists) config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
app.config = config;
app.use(express.static(__dirname + '/public'));
app.use(bodyParser.json({limit: '50mb'}));
app.use(bodyParser.urlencoded({limit: '50mb', extended: true}));
require('./helpers/debug')(app);
require('./helpers/generateResponse')(app);
require('./helpers/configHelper')(app);
require('./helpers/blockchainHelper')(app);
require('./helpers/captchaHelper')(app);
require('./controllers/index')(app);
require('./controllers/getTxCallBack')(app);
app.get('/', function(request, response) {
response.send('Viction testnet faucet');
});
app.set('port', (process.env.PORT || 3000));
app.listen(app.get('port'), function () {
console.log('Viction Testnet faucet is running on port', app.get('port'));
});