Adding request works (mostly)

Everything works except adding the new request back to the list; this
proof of concept is a go, and will be merged to master
This commit is contained in:
Daniel J. Summers
2017-09-21 18:45:06 -05:00
parent 794a365f08
commit 015645aa86
14 changed files with 179 additions and 55 deletions

View File

@@ -6,17 +6,30 @@ const env = process.env.NODE_ENV || 'dev'
if ('dev' === env) require('babel-register')
const app = require('./index').default
const db = require('./db').default
const json = require('./json.mjs').default
const fullEnv = ('dev' === env) ? 'Development' : 'Production'
/** Configuration for the application */
const appConfig = require('./appsettings.json')
const { port } = json('./appsettings.json')
/** Express app */
const app = require('./index').default
/**
* Log a start-up message for the app
* @param {string} status The status to display
*/
const startupMsg = (status) => {
console.log(chalk`{reset myPrayerJournal ${status} | Port: {bold ${port}} | Mode: {bold ${fullEnv}}}`)
}
// Ensure the database exists...
require('./db').default.verify().then(() =>
// ...and start it up!
app.listen(appConfig.port, () => {
console.log(chalk`{reset myPrayerJournal | Port: {bold ${appConfig.port}} | Mode: {bold ${fullEnv}}}`)
}))
// Ensure the database exists before starting up
db.verify()
.then(() => app.listen(port, () => startupMsg('ready')))
.catch(err => {
console.log(chalk`\n{reset {bgRed.white.bold || Error connecting to PostgreSQL }}`)
for (let key of Object.keys(err)) {
console.log(chalk`${key}: {reset {bold ${err[key]}}}`)
}
console.log('')
startupMsg('failed')
})