-
Notifications
You must be signed in to change notification settings - Fork 0
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 #1 from plaidev/convert_to_js
decaffeinate
- Loading branch information
Showing
23 changed files
with
557 additions
and
505 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/node_modules | ||
/npm-debug.log | ||
/Procfile | ||
/.buildpacks | ||
/.buildpacks | ||
/config.js |
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 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,54 @@ | ||
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'); | ||
const routes = require('./routes/index'); | ||
const bot = require('./routes/bot'); | ||
const 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('/bot', bot); | ||
// catch 404 and forward to error handler | ||
app.use((req, res, next) => { | ||
const err = new Error('Not Found'); | ||
err.status = 404; | ||
next(err); | ||
}); | ||
app.use((err, req, res, next) => { | ||
console.log('err', err); | ||
return next(); | ||
}); | ||
// error handlers | ||
// development error handler | ||
// will print stacktrace | ||
if (app.get('env') === 'development') { | ||
app.use((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((err, req, res, next) => { | ||
res.status(err.status || 500); | ||
res.render('error', { | ||
message: err.message, | ||
error: {} | ||
}); | ||
}); | ||
module.exports = app; |
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,85 @@ | ||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
const app = require('../app'); | ||
const debug = require('debug')('myapp:server'); | ||
const http = require('http'); | ||
|
||
/** | ||
* Normalize a port into a number, string, or false. | ||
*/ | ||
|
||
const normalizePort = (val) => { | ||
let port; | ||
port = parseInt(val, 10); | ||
if (isNaN(port)) { | ||
// named pipe | ||
return val; | ||
} | ||
if (port >= 0) { | ||
// port number | ||
return port; | ||
} | ||
return false; | ||
}; | ||
|
||
/** | ||
* Get port from environment and store in Express. | ||
*/ | ||
|
||
const port = normalizePort(process.env.PORT || '5000'); | ||
|
||
|
||
/** | ||
* Event listener for HTTP server "error" event. | ||
*/ | ||
|
||
const onError = (error) => { | ||
if (error.syscall !== 'listen') { | ||
throw error; | ||
} | ||
const 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. | ||
*/ | ||
|
||
const onListening = () => { | ||
const addr = server.address(); | ||
const bind = typeof addr === 'string' ? `pipe ${addr}` : `port ${addr.port}`; | ||
debug(`Listening on ${bind}`); | ||
}; | ||
|
||
app.set('port', port); | ||
|
||
/** | ||
* Create HTTP server. | ||
*/ | ||
|
||
const server = http.createServer(app); | ||
|
||
/** | ||
* Listen on provided port, on all network interfaces. | ||
*/ | ||
|
||
server.listen(port); | ||
server.on('error', onError); | ||
server.on('listening', onListening); | ||
|
||
// --- | ||
// generated by js2coffee 2.2.0 |
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,9 @@ | ||
module.exports = { | ||
KARTE_URL: "https://t.karte.io", | ||
KARTE_BOT_APPLICATION_KEY: "", | ||
KARTE_BOT_SECRET_KEY: "", | ||
ALGOLIA_APPLICATION_ID: "", | ||
ALGOLIA_API_KEY: "", | ||
ALGOLIA_INDEX_NAME: "", | ||
A3RT_API_KEY: "" | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.