All files / example app.js

90.91% Statements 10/11
50% Branches 2/4
66.67% Functions 2/3
90% Lines 9/10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21        1x   1x 1x   1x 1x   1x   1x   1x 1x      
/**
 * Example of using Lark constructing a web app
 **/
'use strict';
process.mainModule = module;
 
const Lark = require('..');
const app = new Lark();
 
app.config.use('configs');
app.config.set('server/port', 8888);
 
app.on('error', (error, ctx) => ctx.logger.error(error.stack) && ctx.logger.log(error.stack));
 
module.exports = app.start()
    .then(({ port, server }) => {
        app.logger.notice(`SERVER[${process.pid}] listening on ${port} ...`);
        return { port, server };
    })
    .catch(e => app.logger.error(e.stack) && app.logger.log(e.stack));