Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
192 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,55 @@ | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
var express = require('express') | ||
, sio = require('socket.io') | ||
, routes = require('./routes') | ||
, path = require('path') | ||
, util = require('util') | ||
, fs = require('fs') | ||
, NrtSc140 = require('./nrtsc140').NrtSc140 | ||
|
||
var app = module.exports = express.createServer(); | ||
|
||
// Configuration | ||
|
||
app.configure(function(){ | ||
app.set('views', __dirname + '/views'); | ||
app.set('view engine', 'jade'); | ||
app.use(express.bodyParser()); | ||
app.use(express.methodOverride()); | ||
app.use(app.router); | ||
app.use(express.static(__dirname + '/public')); | ||
}); | ||
|
||
app.configure('development', function(){ | ||
app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); | ||
}); | ||
|
||
app.configure('production', function(){ | ||
app.use(express.errorHandler()); | ||
}); | ||
|
||
// Routes | ||
|
||
app.get('/', routes.index); | ||
|
||
app.listen(3000); | ||
console.log("Express server listening on port %d in %s mode", | ||
app.address().port, app.settings.env); | ||
|
||
var audioDir = path.join(process.cwd(), 'public', 'audio'); | ||
if (!path.existsSync(audioDir)) { | ||
fs.mkdirSync(audioDir); | ||
} | ||
|
||
// Socket IO | ||
var io = sio.listen(app); | ||
io.sockets.on('connection', function(socket) { | ||
util.debug('connection'); | ||
var nrtsc140 = new NrtSc140(socket); | ||
nrtsc140.start(); | ||
}); | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
var express = require('express') | ||
, sio = require('socket.io') | ||
, routes = require('./routes') | ||
, path = require('path') | ||
, util = require('util') | ||
, fs = require('fs') | ||
, NrtSc140 = require('./nrtsc140').NrtSc140 | ||
|
||
var app = module.exports = express.createServer(); | ||
|
||
// Configuration | ||
|
||
app.configure(function(){ | ||
app.set('views', __dirname + '/views'); | ||
app.set('view engine', 'jade'); | ||
app.use(express.bodyParser()); | ||
app.use(express.methodOverride()); | ||
app.use(app.router); | ||
app.use(express.static(__dirname + '/public')); | ||
}); | ||
|
||
app.configure('development', function(){ | ||
app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); | ||
}); | ||
|
||
app.configure('production', function(){ | ||
app.use(express.errorHandler()); | ||
}); | ||
|
||
// Routes | ||
|
||
app.get('/', routes.index); | ||
|
||
app.listen(3000); | ||
console.log("Express server listening on port %d in %s mode", | ||
app.address().port, app.settings.env); | ||
|
||
var audioDir = path.join(process.cwd(), 'public', 'audio'); | ||
if (!path.existsSync(audioDir)) { | ||
fs.mkdirSync(audioDir); | ||
} | ||
|
||
// Socket IO | ||
var io = sio.listen(app); | ||
io.sockets.on('connection', function(socket) { | ||
util.debug('connection'); | ||
var nrtsc140 = new NrtSc140(socket); | ||
nrtsc140.start(); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
{ | ||
"name": "nrt-sc140" | ||
, "version": "0.0.2" | ||
, "description": "non-realtime sc140 sound file generator web application" | ||
, "author": "Kenichi Kanai" | ||
, "private": false | ||
, "repository": { | ||
"type": "git" | ||
, "url": "http://github.com/kn1kn1/nrt-sc140.git" | ||
} | ||
, "licenses": [{ | ||
"type": "MIT" | ||
, "url": "http://github.com/kn1kn1/nrt-sc140/blob/master/README.md" | ||
}] | ||
, "engines": { | ||
"node": ">=0.6.5" | ||
} | ||
, "dependencies": { | ||
"express": "2.5.2" | ||
, "jade": ">= 0.0.1" | ||
, "socket.io": ">=0.8.7" | ||
, "sc4node": ">=0.0.7" | ||
} | ||
} | ||
{ | ||
"name": "nrt-sc140" | ||
, "version": "0.0.3" | ||
, "description": "non-realtime sc140 sound file generator web application" | ||
, "author": "Kenichi Kanai" | ||
, "private": false | ||
, "repository": { | ||
"type": "git" | ||
, "url": "http://github.com/kn1kn1/nrt-sc140.git" | ||
} | ||
, "licenses": [{ | ||
"type": "MIT" | ||
, "url": "http://github.com/kn1kn1/nrt-sc140/blob/master/README.md" | ||
}] | ||
, "engines": { | ||
"node": ">=0.6.5" | ||
} | ||
, "dependencies": { | ||
"express": "2.5.2" | ||
, "jade": ">= 0.0.1" | ||
, "socket.io": ">=0.8.7" | ||
, "sc4node": ">=0.0.7" | ||
} | ||
} |
Oops, something went wrong.