diff options
Diffstat (limited to 'dgbuilder/dgeflows/src')
-rw-r--r-- | dgbuilder/dgeflows/src/app.js | 70 | ||||
-rw-r--r-- | dgbuilder/dgeflows/src/error.ejs | 3 | ||||
-rw-r--r-- | dgbuilder/dgeflows/src/index.ejs | 16 | ||||
-rw-r--r-- | dgbuilder/dgeflows/src/index.js | 28 | ||||
-rw-r--r-- | dgbuilder/dgeflows/src/package.json | 19 | ||||
-rw-r--r-- | dgbuilder/dgeflows/src/users.js | 9 |
6 files changed, 0 insertions, 145 deletions
diff --git a/dgbuilder/dgeflows/src/app.js b/dgbuilder/dgeflows/src/app.js deleted file mode 100644 index 888ab567..00000000 --- a/dgbuilder/dgeflows/src/app.js +++ /dev/null @@ -1,70 +0,0 @@ -var express = require('express'); -var path = require('path'); -var favicon = require('serve-favicon'); -var logger = require('morgan'); -var cookieParser = require('cookie-parser'); -var bodyParser = require('body-parser'); -var serveIndex = require('serve-index'); -var serveStatic = require('serve-static') - -var routes = require('./routes/index'); -var users = require('./routes/users'); -var dgeusers = require('./dgeusers.json'); -console.log("Read these dgeusers: " + JSON.stringify(dgeusers)); - -var app = express(); - -// view engine setup -app.set('views', path.join(__dirname, 'views')); -app.set('view engine', 'ejs'); - -// uncomment after placing your favicon in /public -//app.use(favicon(__dirname + '/public/favicon.ico')); -app.use(logger('dev')); -app.use(bodyParser.json()); -app.use(bodyParser.urlencoded({ extended: false })); -app.use(cookieParser()); -app.use(express.static(path.join(__dirname, 'public'))); - - -// set up static serving and directory listings for each user's lib/flows directory -dgeusers.forEach( function(dgeuser) { - app.use('/listFlows/'+dgeuser+'/lib/flows', serveIndex('../' + dgeuser+'/lib/flows', {'view': 'details', 'icons': true})) -}); - -app.use('/', routes); -app.use('/users', users); - -// catch 404 and forward to error handler -app.use(function(req, res, next) { - var err = new Error('Not Found'); - err.status = 404; - next(err); -}); - -// error handlers - -// development error handler -// will print stacktrace -if (app.get('env') === 'development') { - app.use(function(err, req, res, next) { - res.status(err.status || 500); - res.render('error', { - message: err.message, - error: err - }); - }); -} - -// production error handler -// no stacktraces leaked to user -app.use(function(err, req, res, next) { - res.status(err.status || 500); - res.render('error', { - message: err.message, - error: {} - }); -}); - - -module.exports = app; diff --git a/dgbuilder/dgeflows/src/error.ejs b/dgbuilder/dgeflows/src/error.ejs deleted file mode 100644 index 7cf94edf..00000000 --- a/dgbuilder/dgeflows/src/error.ejs +++ /dev/null @@ -1,3 +0,0 @@ -<h1><%= message %></h1> -<h2><%= error.status %></h2> -<pre><%= error.stack %></pre> diff --git a/dgbuilder/dgeflows/src/index.ejs b/dgbuilder/dgeflows/src/index.ejs deleted file mode 100644 index c207c7bc..00000000 --- a/dgbuilder/dgeflows/src/index.ejs +++ /dev/null @@ -1,16 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <title><%= title %></title> - <link rel='stylesheet' href='/stylesheets/style.css' /> - </head> - <body> - <center> - <h1><%= title %></h1> - <p>Select user</p> - <% dgeusers.forEach( function(dgeuser) { %> - <p><a href='listFlows/<%= dgeuser %>/lib/flows'><%= dgeuser %></a></p> - <% }); %> - </center> - </body> -</html> diff --git a/dgbuilder/dgeflows/src/index.js b/dgbuilder/dgeflows/src/index.js deleted file mode 100644 index 96a08659..00000000 --- a/dgbuilder/dgeflows/src/index.js +++ /dev/null @@ -1,28 +0,0 @@ -var express = require('express'); -var router = express.Router(); -var dgeusers = require('../dgeusers.json'); -var path = require('path'); -var _ = require('lodash'); - -/* GET home page. */ -router.get('/', function(req, res, next) { - console.log("In route and dgeusers is: " + JSON.stringify(dgeusers)); - res.render('index', { title: 'DGE Flow Browser', dgeusers: dgeusers }); -}); - -// GET a flow file -router.get('/listFlows/:dgeuser/:lib/:flows/:fileName', function(req, res, next) { - console.log("Getting a file..."); - console.dir(req.params); - // make sure we like this user - if ( !(_.includes(dgeusers, req.params.dgeuser)) ) { - console.log("We don't like this user!"); - res.send("No!"); - return; - } - filePath=path.join(__dirname, '../..', req.params.dgeuser, 'lib', 'flows', req.params.fileName); - console.log("Getting this file: " + filePath); - res.sendFile(filePath); -}); - -module.exports = router; diff --git a/dgbuilder/dgeflows/src/package.json b/dgbuilder/dgeflows/src/package.json deleted file mode 100644 index 893aeb9d..00000000 --- a/dgbuilder/dgeflows/src/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "dgeflows", - "version": "0.0.0", - "private": true, - "scripts": { - "start": "node ./bin/www" - }, - "dependencies": { - "body-parser": "~1.10.2", - "cookie-parser": "~1.3.3", - "debug": "~2.1.1", - "ejs": "~2.2.3", - "express": "~4.11.1", - "morgan": "~1.5.1", - "serve-favicon": "~2.2.0", - "serve-index": "^1.6.2", - "serve-static": "^1.9.1" - } -} diff --git a/dgbuilder/dgeflows/src/users.js b/dgbuilder/dgeflows/src/users.js deleted file mode 100644 index 623e4302..00000000 --- a/dgbuilder/dgeflows/src/users.js +++ /dev/null @@ -1,9 +0,0 @@ -var express = require('express'); -var router = express.Router(); - -/* GET users listing. */ -router.get('/', function(req, res, next) { - res.send('respond with a resource'); -}); - -module.exports = router; |