added prettier, removed seperate react eslint config, fixed missing
component display name Markdown.js, and added run method to app
This commit is contained in:
20
src/app.js
20
src/app.js
@@ -29,10 +29,24 @@ const nxt = require('next')({ dev, quiet: true });
|
||||
const nxtHandler = nxt.getRequestHandler();
|
||||
|
||||
const app = express(feathers());
|
||||
app.startNext = () => nxt.prepare();
|
||||
app.configure(configuration()); // Load app configuration
|
||||
|
||||
Object.keys(hostConfig).forEach(key => ( // load host config
|
||||
app.run = async port => {
|
||||
const server = app.listen(port);
|
||||
await nxt.prepare();
|
||||
|
||||
if(dev) {
|
||||
server.on('upgrade', (req, socket) => {
|
||||
nxtHandler(req, socket, parse(stripBase(req.url), true));
|
||||
});
|
||||
}
|
||||
return server;
|
||||
};
|
||||
|
||||
// Load app configuration
|
||||
app.configure(configuration());
|
||||
|
||||
// load host config
|
||||
Object.keys(hostConfig).forEach(key => (
|
||||
app.set(key, hostConfig[key])
|
||||
));
|
||||
app.set('didSetup', false);
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
const logger = require('winston');
|
||||
const app = require('./app');
|
||||
const port = app.get('port');
|
||||
const server = app.listen(port);
|
||||
|
||||
app.startNext();
|
||||
|
||||
server.on('listening', () =>
|
||||
app.run(port).then(() => {
|
||||
logger.info('MYKB listening at http://%s:%d', app.get('host'), port)
|
||||
);
|
||||
})
|
||||
|
||||
process.on('unhandledRejection', (reason, p) =>
|
||||
logger.error('Unhandled Rejection at: Promise ', p, reason)
|
||||
|
||||
Reference in New Issue
Block a user