diff --git a/lib/index.js b/lib/index.js index ed5a73208..bbb6a31ad 100644 --- a/lib/index.js +++ b/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() + diff --git a/package.json b/package.json index 5fbc10768..38c462f66 100644 --- a/package.json +++ b/package.json @@ -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",