const express = require('express')
    , path = require('path')
    , CONFIG = require('../config')
    , CONFIG_PATH = CONFIG.path
    , cookieParser = require('cookie-parser')
    , bodyParser = require('body-parser')
    , logger = require('morgan')
    , http = require('http')
    , broadcast = require('./broadcast')

// var favicon = require('serve-favicon');

let app = express();

// uncomment after placing your favicon in /public
//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
// app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());

app.use(
    express.static(CONFIG_PATH.dist)
);

// catch 404 and forward to error handler
app.use(function(req, res, next) {
    var err = new Error('Not Found');
    err.status = 404;
    next(err);
});

// error handler
app.use(function(err, req, res, next) {
    // set locals, only providing error in development
    res.locals.message = err.message;
    res.locals.error = req.app.get('env') === 'development' ? err : {};

    // render the error page
    res.status(err.status || 500);
    res.render('error');
});

let PORT = CONFIG.server.PORT || 4444; 
let server = http.createServer(app);
server.listen(PORT);

console.log(`Listen On ${PORT}`)


@@ -320,849 +320,57 @@
 t')%0A
-%0A// var favicon = require('serve-favicon');%0A%0Alet app = express();%0A%0A// uncomment after placing your favicon in /public%0A//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));%0A// app.use(logger('dev'));%0Aapp.use(bodyParser.json());%0Aapp.use(bodyParser.urlencoded(%7B extended: false %7D));%0Aapp.use(cookieParser());%0A%0Aapp.use(%0A    express.static(CONFIG_PATH.dist)%0A);%0A%0A// catch 404 and forward to error handler%0Aapp.use(function(req, res, next) %7B%0A    var err = new Error('Not Found');%0A    err.status = 404;%0A    next(err);%0A%7D);%0A%0A// error handler%0Aapp.use(function(err, req, res, next) %7B%0A    // set locals, only providing error in development%0A    res.locals.message = err.message;%0A    res.locals.error = req.app.get('env') === 'development' ? err : %7B%7D;%0A%0A    // render the error page%0A    res.status(err.status %7C%7C 500);%0A    res.render('error');%0A%7D);
+    , serve = require('serve')%0A%0A%0A// static serve 
 %0A%0Ale
@@ -411,65 +411,53 @@
 4; %0A
-let 
+%0A
 serve
-r = http.createServer(app);%0Aserver.listen(PORT);
+(CONFIG_PATH.dist, %7B%0A    port: PORT%0A%7D)%0A
 %0A%0Aco

use `serve` for static file server