Download mission file

This commit is contained in:
Björn Dahlgren 2014-04-05 19:27:54 +00:00
parent 76c05d9c7d
commit 11150bc59b
2 changed files with 8 additions and 3 deletions

View File

@ -1,5 +1,5 @@
<td>
<a href='#missions/<%-name%>'><%-name%></a>
<a href='/api/missions/<%-name%>'><%-name%></a>
</td>
<td>
<button type="button" class="btn btn-danger btn-xs delete">

View File

@ -21,7 +21,6 @@ exports.create = function(req, res){
fs.readFile(missionFile.path, function (err, data) {
var newPath = config.path + '/mpmissions/' + missionFile.name;
console.log(newPath);
fs.writeFile(newPath, data, function (err) {
res.json(missionFile);
});
@ -29,7 +28,13 @@ exports.create = function(req, res){
};
exports.show = function(req, res){
res.send('download mission ' + req.params.mission);
var path = config.path + '/mpmissions/' + req.params.mission;
if (req.params.format) {
path += '.' + req.params.format;
}
res.download(path);
};
exports.destroy = function(req, res){