-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from impronunciable/feature-refactor-es6
Core: Partially moved to ES6.
- Loading branch information
Showing
64 changed files
with
1,953 additions
and
3,446 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
db: { | ||
name: "hackdash", | ||
host: "localhost", | ||
url: null | ||
}, | ||
host: "local.host", | ||
port: 3000, | ||
session: "wefewfef", | ||
disqus_shortname: null, | ||
title: "hackdash", | ||
live: true, | ||
mailer: null, | ||
prerender: { | ||
enabled: false, | ||
db: "mongodb://localhost/prerender" | ||
}, | ||
team: [ | ||
"516d1997b2951b02280000e1", | ||
"516d1997b2951b02280000e2", | ||
"516d1997b2951b02280000e3", | ||
"516d1997b2951b02280000e4", | ||
"516d1997b2951b02280000e5", | ||
"516d1997b2951b02280000e6" | ||
], | ||
maxQueryLimit: 30, | ||
googleAnalytics: "UA-XXXXXXXX-X", | ||
facebookAppId: "YYYYYYYYYYYY" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
/** | ||
* Expose the configuration. Uses the test config if NODE_ENV env setting | ||
* is set as 'test'. Otherwise it uses the default config file | ||
*/ | ||
|
||
import config from './config.json'; | ||
import testConfig from './config.test.json'; | ||
|
||
export default process.env.NODE_ENV === 'test' ? testConfig : config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
require('babel/register'); | ||
|
||
var app = require('lib/server'); | ||
var debug = require('debug')('hackdash:server'); | ||
var http = require('http'); | ||
var config = require('config'); | ||
var live = require('lib/live'); | ||
|
||
/** | ||
* 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); | ||
|
||
/* | ||
* Live dashboard. It uses socketIO to provide cool `realtime` features | ||
* it's an opt-in from the config file. | ||
*/ | ||
|
||
if(config.live) { | ||
live(app, server); | ||
} | ||
|
||
/** | ||
* 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); | ||
} |
Oops, something went wrong.