Skip to content

Commit

Permalink
added framework for menu and site layout
Browse files Browse the repository at this point in the history
  • Loading branch information
smithy545 committed Jul 6, 2016
1 parent 8240b3f commit 5ab4748
Show file tree
Hide file tree
Showing 29 changed files with 10,518 additions and 18 deletions.
60 changes: 60 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
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 routes = require('./routes/index');
var users = require('./routes/users');

var app = express();

// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');

// uncomment after placing your favicon in /public
//app.use(favicon(path.join(__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')));

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;
90 changes: 90 additions & 0 deletions bin/www
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#!/usr/bin/env node

/**
* Module dependencies.
*/

var app = require('../app');
var debug = require('debug')('reuapp:server');
var http = require('http');

/**
* Get port from environment and store in Express.
*/

var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);

/**
* Create HTTP server.
*/

var server = http.createServer(app);

/**
* Listen on provided port, on all network interfaces.
*/

server.listen(port);
server.on('error', onError);
server.on('listening', onListening);

/**
* Normalize a port into a number, string, or false.
*/

function normalizePort(val) {
var port = parseInt(val, 10);

if (isNaN(port)) {
// named pipe
return val;
}

if (port >= 0) {
// port number
return port;
}

return false;
}

/**
* Event listener for HTTP server "error" event.
*/

function onError(error) {
if (error.syscall !== 'listen') {
throw error;
}

var bind = typeof port === 'string'
? 'Pipe ' + port
: 'Port ' + port;

// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error(bind + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
console.error(bind + ' is already in use');
process.exit(1);
break;
default:
throw error;
}
}

/**
* Event listener for HTTP server "listening" event.
*/

function onListening() {
var addr = server.address();
var bind = typeof addr === 'string'
? 'pipe ' + addr
: 'port ' + addr.port;
debug('Listening on ' + bind);
}
42 changes: 42 additions & 0 deletions npm-debug.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
0 info it worked if it ends with ok
1 verbose cli [ '/home/philip/.nvm/versions/node/v4.4.5/bin/node',
1 verbose cli '/home/philip/.nvm/versions/node/v4.4.5/bin/npm',
1 verbose cli 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info prestart [email protected]
6 info start [email protected]
7 verbose unsafe-perm in lifecycle true
8 info [email protected] Failed to exec start script
9 verbose stack Error: [email protected] start: `node ./bin/www`
9 verbose stack Exit status 1
9 verbose stack at EventEmitter.<anonymous> (/home/philip/.nvm/versions/node/v4.4.5/lib/node_modules/npm/lib/utils/lifecycle.js:217:16)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at EventEmitter.emit (events.js:172:7)
9 verbose stack at ChildProcess.<anonymous> (/home/philip/.nvm/versions/node/v4.4.5/lib/node_modules/npm/lib/utils/spawn.js:24:14)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at ChildProcess.emit (events.js:172:7)
9 verbose stack at maybeClose (internal/child_process.js:827:16)
9 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
10 verbose pkgid [email protected]
11 verbose cwd /home/philip/Documents/github/reuapp
12 error Linux 4.4.0-28-generic
13 error argv "/home/philip/.nvm/versions/node/v4.4.5/bin/node" "/home/philip/.nvm/versions/node/v4.4.5/bin/npm" "start"
14 error node v4.4.5
15 error npm v2.15.5
16 error code ELIFECYCLE
17 error [email protected] start: `node ./bin/www`
17 error Exit status 1
18 error Failed at the [email protected] start script 'node ./bin/www'.
18 error This is most likely a problem with the reuapp package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error node ./bin/www
18 error You can get information on how to open an issue for this project with:
18 error npm bugs reuapp
18 error Or if that isn't available, you can get their info via:
18 error
18 error npm owner ls reuapp
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]
28 changes: 10 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
{
"name": "reuapp",
"version": "1.0.0",
"description": "An app to help with REU(Research Experience for Undergraduates) Applications",
"main": "index.js",
"version": "0.0.0",
"private": true,
"scripts": {
"test": "test"
"start": "node ./bin/www"
},
"repository": {
"type": "git",
"url": "git+https://github.com/smithy545/REU-Apply.git"
},
"keywords": [
"reu"
],
"author": "Philip Arturo Smith",
"license": "ISC",
"bugs": {
"url": "https://github.com/smithy545/REU-Apply/issues"
},
"homepage": "https://github.com/smithy545/REU-Apply#readme",
"dependencies": {
"express": "^4.14.0"
"body-parser": "~1.15.1",
"cookie-parser": "~1.4.3",
"debug": "~2.2.0",
"express": "~4.13.4",
"jade": "~1.11.0",
"morgan": "~1.7.0",
"serve-favicon": "~2.3.0"
}
}
Binary file added public/fonts/glyphicons-halflings-regular.eot
Binary file not shown.
Loading

0 comments on commit 5ab4748

Please sign in to comment.