2013-10-27 21:17:45 +04:00
|
|
|
var http = require('http'),
|
2013-10-27 20:26:27 +04:00
|
|
|
express = require('express'),
|
|
|
|
app = express();
|
|
|
|
|
|
|
|
app.use(express.logger());
|
2013-10-27 20:31:26 +04:00
|
|
|
app.use(express.static(__dirname));
|
|
|
|
app.use(express.directory(__dirname));
|
2013-10-27 20:26:27 +04:00
|
|
|
|
|
|
|
var server = http.createServer(app);
|
|
|
|
server.listen(8080);
|
|
|
|
console.log('Listening on http://localhost:8080');
|
|
|
|
|
2013-10-27 21:15:35 +04:00
|
|
|
var db = [
|
|
|
|
{
|
|
|
|
"label" : "Trumpet",
|
2013-10-27 21:46:49 +04:00
|
|
|
"notes" : [[0],[1],[2],[3],[4],[3],[4],[3],[4],[3],[2],[1],[0],[0],[0],[0]],
|
|
|
|
"audioClips" : [
|
|
|
|
"sounds/funkshots Trumpet-1.wav",
|
|
|
|
"sounds/funkshots Trumpet-3.wav",
|
|
|
|
"sounds/funkshots Trumpet-5.wav",
|
|
|
|
"sounds/funkshots Trumpet-7.wav",
|
|
|
|
"sounds/funkshots Trumpet-8.wav"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"label": "Bass",
|
|
|
|
"notes": [[1],[1],[1],[1],[0],[0],[0],[0],[3],[3],[3],[3],[0],[0],[0],[0]],
|
|
|
|
"audioClips" : [
|
|
|
|
"sounds/funkshots Bass-1.wav",
|
|
|
|
"sounds/funkshots Bass-3.wav",
|
|
|
|
"sounds/funkshots Bass-5.wav",
|
|
|
|
"sounds/funkshots Bass-7.wav",
|
|
|
|
"sounds/funkshots Bass-8.wav"
|
|
|
|
]
|
2013-10-27 21:15:35 +04:00
|
|
|
}
|
2013-10-27 21:46:49 +04:00
|
|
|
];
|
2013-10-27 20:26:27 +04:00
|
|
|
|
|
|
|
app.post('/data', express.urlencoded(), function(req, res) {
|
|
|
|
db = req.body;
|
|
|
|
res.send(200);
|
|
|
|
});
|
|
|
|
|
2013-10-27 20:56:08 +04:00
|
|
|
app.get('/data', function(req, res) {
|
|
|
|
res.json(db);
|
|
|
|
});
|