-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.js
22 lines (19 loc) · 868 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
var express = require('express'),
app = express(),
port = process.env.PORT || 3000,
fs = require('fs'),
bodyParser = require('body-parser'),
SCController = require('easyweb3'), //My library to simplify smart contract interaction
Web3 = require('web3'), //This is here just for testing
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
//Rest server config and start
app.use(express.static(__dirname + '/client')) //To define what folder is the public directort
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
//Define where routes to access the server are
var routes = require('./API/Routes/ApiRoutes');
routes(app);
app.listen(port);
console.log('Lingotts\'s RESTful API server started on: ' + port);
console.log('This are the accounts of your node in order');
console.log(web3.eth.accounts);