-
Notifications
You must be signed in to change notification settings - Fork 76
/
index.js
45 lines (38 loc) · 1.02 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
43
44
45
const express = require('express')
const fs = require('fs')
const bodyParser = require('body-parser')
let app = express();
require('./src/helpers/blockchain-helper')(app)
let config
const configPath = './config.json'
const configExists = fs.existsSync(configPath, fs.F_OK)
if (configExists) {
config = JSON.parse(fs.readFileSync(configPath, 'utf8'))
} else {
return console.log('There is no config.json file')
}
app.config = config
let web3
app.configureWeb3(config)
.then(web3 => {
app.web3 = web3
app.use(express.static(__dirname + '/public'))
app.use(bodyParser.json({
limit: '50mb',
}))
app.use(bodyParser.urlencoded({
limit: '50mb',
extended: true,
}))
require('./src/controllers/index')(app)
app.get('/', function(request, response) {
response.send('Sokol POA Network faucet')
});
app.set('port', (process.env.PORT || 5000))
app.listen(app.get('port'), function () {
console.log('Sokol testnet POA Network faucet is running on port', app.get('port'))
})
})
.catch(error => {
return console.log(error)
})