add server functionality

This commit is contained in:
Iuri Matias 2016-08-14 11:10:34 -04:00
parent dfb365d07e
commit 00a7dbe2f1
2 changed files with 25 additions and 0 deletions

View File

@ -3,6 +3,7 @@ var Web3 = require('web3');
var fs = require('fs');
var grunt = require('grunt');
var mkdirp = require('mkdirp');
var colors = require('colors');
var Deploy = require('./deploy.js');
var ContractsManager = require('./contracts.js');
@ -68,8 +69,29 @@ var Embark = {
//console.log(content);
fs.writeFileSync("dist/" + targetFile, content);
}
},
server: function() {
var finalhandler = require('finalhandler');
var http = require('http');
var serveStatic = require('serve-static');
// Serve up public/ftp folder
var serve = serveStatic('dist/', {'index': ['index.html', 'index.htm']});
// Create server
var server = http.createServer(function onRequest (req, res) {
serve(req, res, finalhandler(req, res));
});
// Listen
console.log("listening on port 8000".underline.bgWhite.green);
server.listen(8000) ;
}
};
//module.exports = Embark;
//Embark.buildAssets();
//Embark.server()

View File

@ -15,12 +15,15 @@
"dependencies": {
"async": "^2.0.1",
"bignumber.js": "debris/bignumber.js#master",
"colors": "^1.1.2",
"commander": "^2.8.1",
"finalhandler": "^0.5.0",
"grunt": "^0.4.5",
"js-sha3": "^0.3.1",
"meteor-build-client": "^0.1.6",
"mkdirp": "^0.5.1",
"read-yaml": "^1.0.0",
"serve-static": "^1.11.1",
"shelljs": "^0.5.0",
"toposort": "^0.2.10",
"web3": "^0.15.0",