-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8e824e0
commit 04eabd8
Showing
10 changed files
with
61 additions
and
63 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 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,14 +1,14 @@ | ||
const config = require('config'); | ||
const util = require('util') | ||
const util = require('util'); | ||
|
||
exports.show = async (ctx, error) => { | ||
try { | ||
return await ctx.render('error', { | ||
pretty: config.prettyHtml, | ||
title: config.name, | ||
error: error | ||
}); | ||
} catch (ex) { | ||
util.log(ex) | ||
} | ||
} | ||
try { | ||
return await ctx.render('error', { | ||
pretty: config.prettyHtml, | ||
title: config.name, | ||
error: error | ||
}); | ||
} catch (ex) { | ||
util.log(ex); | ||
} | ||
}; |
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 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 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 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 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 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,19 +1,13 @@ | ||
const config = require('config'); | ||
const util = require('util'); | ||
const mongoose = require('mongoose'); | ||
|
||
module.exports = () => { | ||
mongoose.Promise = global.Promise; | ||
|
||
mongoose.connection.on('open', util.log.bind(util, 'MongoDB connection open')); | ||
mongoose.connection.on('disconnected', util.log.bind(util, 'MongoDB connection disconnected')); | ||
mongoose.connection.on('error', console.error.bind(console, 'MongoDB connection error:')); | ||
|
||
mongoose.set('useCreateIndex', true); | ||
mongoose.set('useFindAndModify', false); | ||
//mongoose.set('debug', true); | ||
|
||
mongoose.connect(`mongodb://${config.database.host}/${config.database.db}`, { useNewUrlParser: true }); | ||
mongoose.connect(`mongodb://${config.database.host}/${config.database.db}`, { | ||
useCreateIndex: true, | ||
useNewUrlParser: true | ||
}); | ||
|
||
return mongoose.connection; | ||
}; |
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 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,9 +1,8 @@ | ||
|
||
const config = require('config'); | ||
const util = require('util'); | ||
const app = require('./app'); | ||
require('./db')(); | ||
|
||
module.exports = app.listen(process.env.PORT || config.port || 3000, function() { | ||
util.log('Server started: http://localhost:%s/', this.address().port); | ||
console.log('Server started: http://localhost:%s/', this.address().port); | ||
}); |