Skip to content

Commit

Permalink
Converting to ES2015
Browse files Browse the repository at this point in the history
  • Loading branch information
snowyfox committed Jul 17, 2017
1 parent 7c6feda commit b7fad4d
Show file tree
Hide file tree
Showing 48 changed files with 279 additions and 383 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
MobileDatabase.iml
.idea
node_modules
.DS_Store
24 changes: 12 additions & 12 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@

process.env.NODE_ENV = "development";

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');
const express = require('express');
const path = require('path');
const favicon = require('serve-favicon');
const logger = require('morgan');
const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');

console.log("ENV: " + process.env.NODE_ENV);

var rebuildDatabase = false;
const rebuildDatabase = true;

if(rebuildDatabase){
var dictionary = require('./eanaEltuMigration/dictionary');
const dictionary = require('./eanaEltuMigration/dictionary');

dictionary.buildDictionary(function(){
// We have a full Dictionary now to do things with :)
Expand All @@ -28,10 +28,10 @@ if(rebuildDatabase){



var app = express();
const app = express();

var index = require('./routes/index');
var apiV1 = require('./routes/apiV1');
const index = require('./routes/index');
const apiV1 = require('./routes/apiV1');

// view engine setup
app.set('views', path.join(__dirname, 'views'));
Expand All @@ -50,7 +50,7 @@ app.use('/api/v1', apiV1);

// catch 404 and forward to error handler
app.use(function(req, res, next) {
var err = new Error('Not Found');
const err = new Error('Not Found');
err.status = 404;
next(err);
});
Expand Down
2 changes: 2 additions & 0 deletions auth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

const passport = require('passport');
18 changes: 9 additions & 9 deletions bin/www
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
* Module dependencies.
*/

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

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

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

/**
* Create HTTP server.
*/

var server = http.createServer(app);
const server = http.createServer(app);

/**
* Listen on provided port, on all network interfaces.
Expand All @@ -34,7 +34,7 @@ server.on('listening', onListening);
*/

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

if (isNaN(port)) {
// named pipe
Expand All @@ -58,7 +58,7 @@ function onError(error) {
throw error;
}

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

Expand All @@ -82,8 +82,8 @@ function onError(error) {
*/

function onListening() {
var addr = server.address();
var bind = typeof addr === 'string'
const addr = server.address();
const bind = typeof addr === 'string'
? 'pipe ' + addr
: 'port ' + addr.port;
debug('Listening on ' + bind);
Expand Down
Loading

0 comments on commit b7fad4d

Please sign in to comment.