What I need is to fetch any kind of file from node server from my android app. On my server I have different types of files (same path as server.js file).
Therefore I use this code in my android app: http://www.androidhive.info/2012/04/android-downloading-file-by-showing-progress-bar/
Following code server side on node server:
var express = require('express'),
app = express();
var http = require('http').Server(app);
app.get('/', function(req, res){
res.sendFile('./SomeTrack.mp3', {root: __dirname});});
http.listen(3000, function(){
});
With that code and this url http://localhost:3000/ I get a response for a specific file successfully (specific file meaning it's the only one on server at that time).
Now, I need some advice on how I can change server code so that I can fetch any file (when there are more files on server) over url (e.g. localhost:3000/fileXY.x) and download it to my android app.
Possible solutions:
queries, parameters
Cheers!
via Dave Gee
No comments:
Post a Comment