Skip to content

Commit

Permalink
added /metadata POST endpoint.
Browse files Browse the repository at this point in the history
  • Loading branch information
toolness committed Jul 9, 2012
1 parent d0d258b commit d6156c0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
8 changes: 8 additions & 0 deletions app.js
Expand Up @@ -7,6 +7,14 @@ var STATIC_DIR = __dirname + '/static',
FFMPEG_VORBIS = 'ffmpeg',
FFMPEG_MP3 = '/Applications/ffmpegX.app/Contents/Resources/ffmpeg';

app.post('/metadata', function(req, res) {
var filename = STATIC_DIR + '/metadata.json',
outfile = fs.createWriteStream(filename);

req.pipe(outfile);
res.send("Thanks!");
});

app.post('/audio', function(req, res) {
var name = req.get('name', 'UNKNOWN'),
basefilename = STATIC_DIR + '/outfile',
Expand Down
9 changes: 8 additions & 1 deletion static/index.html
Expand Up @@ -41,9 +41,16 @@

$("#stop").click(function stopRecording() {
if (recordState == "recording") {
console.log("STOP HAZ BEEN CLICK'D");
Wami.stopRecording();
recordState = "uploading";
jQuery.ajax({
type: 'POST',
url: '/metadata',
data: JSON.stringify({hi: 'there'}),
success: function() {
console.log("metadata uploaded.");
}
});
}
});

Expand Down

0 comments on commit d6156c0

Please sign in to comment.