Permalink
Browse files

added static server

  • Loading branch information...
garris committed Oct 9, 2014
1 parent 807c83e commit ec9c7e7703a2108ed8c5957338b8623628183b51
Showing with 83 additions and 0 deletions.
  1. +23 −0 package.json
  2. +60 −0 server.js
View
@@ -0,0 +1,23 @@
{
"name": "artDotCom_MQ_prototype",
"version": "0.0.0",
"description": "",
"main": "",
"devDependencies": {
"gulp": "^3.8.8",
"gulp-less": "^1.3.6",
"gulp-less-sourcemap": "^1.3.3",
"del": "^0.1.3",
"resemblejs": "^1.2.0"
},
"scripts": {},
"author": "",
"license": "",
"dependencies": {
"gulp-open": "^0.3.0",
"bunyan": "~0.22.3",
"express": "^3.8.1",
"http-proxy": "~1.1.4",
"underscore": "~1.6.0"
}
}
View
@@ -0,0 +1,60 @@
var express = require('express')
,app = express()
,bunyan = require('bunyan')
,_ = require('underscore')
,util = require('util')
,os = require('os')
,sys = require('sys')
,exec = require('child_process').exec;
var rootDir = __dirname;
var port = 3000;
app.use(express.json());
app.use(express.urlencoded());
app.use(express.static(rootDir));
app.all('/app/',function(req,res){
console.log(new Date());
exec("gulp test",puts);
res.send('ok');
})
app.listen(port);
//===================
console.log()
console.log('Current Directory: '+__dirname)
console.log('Serving files from: '+rootDir)
console.log('Listening on: ' + getAddresses() + ':' + port + '');
console.log('Press Ctrl + C to stop.');
//=====================
function getAddresses(){
var interfaces = os.networkInterfaces(),
addresses = [];
_.each(interfaces,function(net){
_.each(net,function(address){
if (address.family == 'IPv4' && !address.internal) addresses.push(address.address);
})
})
return addresses;
}
function puts(error, stdout, stderr) {sys.puts(stdout)}

0 comments on commit ec9c7e7

Please sign in to comment.