mirror of https://github.com/embarklabs/embark.git
add server functionality
This commit is contained in:
parent
dfb365d07e
commit
00a7dbe2f1
22
lib/index.js
22
lib/index.js
|
@ -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()
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue