Commit f6388ebf authored by Andrew Cohen's avatar Andrew Cohen

use the lever.js readfile for both server and electron experiment window calls

parent 3c0be58e
......@@ -161,26 +161,6 @@ function getCellCosts(req,res)
}); // lDB.all (constants)
} // getCellCosts
function getDBs(req,res)
{
const fs=require('fs');
const path=require('path');
fs.readdir(req.ROOT,function(err,files) {
if (err)
console.error('leverjsServer: ReadDir error: ' + err);
else {
var flist=[];
files.forEach(function (row) {
if ('.LEVER'==path.extname(row)) {
flist.push(path.basename(row,'.LEVER'));
}
});
res.send(JSON.stringify(flist));
}
});
} // getDBs
function getImageFileName(CONSTANTS,req)
{
var fname;
......@@ -489,7 +469,6 @@ module.exports.setAlgorithmInDB=setAlgorithmInDB;
module.exports.getImage=getImage;
module.exports.getFamilies=getFamilies;
module.exports.getConstants=getConstants;
module.exports.getDBs=getDBs;
module.exports.getCells=getCells;
module.exports.getCellCentroids=getCellCentroids;
module.exports.getCellPixels=getCellPixels;
......
......@@ -352,8 +352,11 @@ app.get('/:LEVER/families', setLeverRoot, function(req,res){
});
app.get('/lever', setLeverRoot, function(req,res){
const helper=require('./leverjs/serverHelper.js');
helper.getDBs(req,res);
const LeverDB=require('./leverjs/lever.js');
var leverDB=new LeverDB();
leverDB.leverGetFileList(ROOT,function(leverFileList){
res.send(leverFileList);
})
});
// serve the dataset :LEVER javascript / client page
......@@ -361,7 +364,7 @@ app.get('/:LEVER/lever', function (req, res) {
const LeverDB=require('./leverjs/lever.js');
var leverDB=new LeverDB();
var leverFile=decodeURI(req.params.LEVER);
leverFile = path.join(ROOT,leverFile+'.LEVER');
leverFile = path.join(ROOT,leverFile);
leverDB.leverRead(leverFile,0,req.headers.host,function(err,leverStruct){
if(err) {
res.status(400).send(JSON.stringify(err));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment