mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-24 16:22:44 +00:00
This is done in order to have config creation rules unified in one place to avoid modifying them multiple times if they change. We already had 3 duplicated pieces of code initializing the config and there will be more config uses in future tests. This resolves #1960
14 lines
398 B
JavaScript
14 lines
398 B
JavaScript
const DB = require('./server/db.js');
|
|
const server = require('./server/app.js');
|
|
|
|
const config = require('./server/config.js');
|
|
|
|
DB.connect(config).then(()=>{
|
|
// Ensure that we have successfully connected to the database
|
|
// before launching server
|
|
const PORT = process.env.PORT || config.get('web_port') || 8000;
|
|
server.app.listen(PORT, ()=>{
|
|
console.log(`server on port: ${PORT}`);
|
|
});
|
|
});
|