diff options
| author | jw255 | 2018-01-16 17:33:58 +0000 |
|---|---|---|
| committer | jw255 | 2018-01-16 17:33:58 +0000 |
| commit | 4cd8de869d493d95343ee09a186ac94ef6ce2bf4 (patch) | |
| tree | 1e33914f48f222992a8ba2332fdd984c741fe0a4 /dist/FileRouter.js | |
| parent | updated readme, todo to explain/include changes. wrote a test for helloworld.... (diff) | |
| download | medicine-4cd8de869d493d95343ee09a186ac94ef6ce2bf4.tar.gz medicine-4cd8de869d493d95343ee09a186ac94ef6ce2bf4.zip | |
added router class to handle API calls and updated TODO with latest Protocol decisions available
Diffstat (limited to 'dist/FileRouter.js')
| -rw-r--r-- | dist/FileRouter.js | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/dist/FileRouter.js b/dist/FileRouter.js new file mode 100644 index 0000000..adf87cc --- /dev/null +++ b/dist/FileRouter.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const express_1 = require("express"); +const Files = null; //require('../data'); +/* + * |-> + * /project/files/directory/file?filters + * |-> + */ +class FileRouter { + /** + * Initialize the FileRouter + */ + constructor() { + this.router = express_1.Router(); + this.init(); + } + /** + * GET a File. + */ + getFile(req, res, next) { + let fileID = req.params.file; + // check if fileID is number or path + // find file in data + // check if only metadata was requested and return appropriate info + // otherwise: + // if image: + // convert if necessary + // zoom if necessary + // if csv/xls + // send data in appropriate csv format + // limit cols if necessary + res.send("File"); + } + /** + * Take each handler, and attach to one of the Express.Router's + * endpoints. + */ + init() { + this.router.get('/:file', this.getFile); + } +} +exports.FileRouter = FileRouter; +// Create the FileRouter, and export its configured Express.Router +const fileRoutes = new FileRouter(); +fileRoutes.init(); +exports.default = fileRoutes.router; |
