Skip to content

Commit

Permalink
Modified gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
pierotofy committed Jul 5, 2016
1 parent 9aa3461 commit 31f5301
Show file tree
Hide file tree
Showing 63 changed files with 10,990 additions and 8 deletions.
17 changes: 12 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
FROM opendronemap:latest
MAINTAINER Piero Toffanin
FROM opendronemap/opendronemap:latest
MAINTAINER Piero Toffanin <[email protected]>

RUN apt-get update
EXPOSE 3000

USER root
RUN curl --silent --location https://deb.nodesource.com/setup_5.x | sudo bash -
RUN apt-get install -y nodejs

RUN mkdir /var/www
RUN chown odm:odm /var/www

USER odm
WORKDIR "/var/www"
RUN git clone https://github.com/pierotofy/node-OpenDroneMap
RUN git clone https://github.com/pierotofy/node-OpenDroneMap .
RUN npm install

CMD ["/usr/bin/nodejs", "/var/www/index.js"]
ENTRYPOINT ["/usr/bin/nodejs", "/var/www/index.js"]
1 change: 1 addition & 0 deletions data/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
35 changes: 33 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,41 @@
"use strict";

let fs = require('fs');
let express = require('express');
let app = express();

app.get('/', (req, res) => {
res.send('Hello World!');
let addRequestId = require('./libs/express-request-id')();
let multer = require('multer');

app.use(express.static('public'));

let upload = multer({
storage: multer.diskStorage({
destination: (req, file, cb) => {
let path = `tmp/${req.id}/`;
fs.exists(path, exists => {
if (!exists){
fs.mkdir(path, undefined, () => {
cb(null, path);
});
}else{
cb(null, path);
}
});
},
filename: (req, file, cb) => {
cb(null, file.originalname)
}
})
});

app.post('/newTask', addRequestId, upload.array('images'), (req, res, next) => {
console.log(`Received ${req.files.length} files`);
if (req.files.length){

}
console.log("Name: " + req.body.name);
res.json({uuid: req.id, success: true});
});

app.listen(3000, () => {
Expand Down
17 changes: 17 additions & 0 deletions libs/express-request-id.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict';

var uuid = require('node-uuid');

module.exports = function (options) {
options = options || {};
options.uuidVersion = options.uuidVersion || 'v4';
options.setHeader = options.setHeader === undefined || !!options.setHeader;

return function (req, res, next) {
req.id = uuid[options.uuidVersion](options, options.buffer, options.offset);
if (options.setHeader) {
res.setHeader('X-Request-Id', req.id);
}
next();
};
};
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
},
"homepage": "https://github.com/pierotofy/node-OpenDroneMap#readme",
"dependencies": {
"express": "^4.14.0"
"express": "^4.14.0",
"multer": "^1.1.0",
"node-uuid": "^1.4.7"
},
"devDependencies": {
"nodemon": "^1.9.2"
}
}
11 changes: 11 additions & 0 deletions public/css/bootstrap.min.css

Large diffs are not rendered by default.

Loading

0 comments on commit 31f5301

Please sign in to comment.