/**
 * Create a new static server.
 * @function serverside.server.newStaticServer
 * @param {object} config - Configuration object.
 * @param {string} config.contextLoader - Context loader file name.
 * @param {object} use - Middleware usages.
 * @author Taka Okunishi
 *
 */

var http = require('http'),
    path = require('path');

exports = module.exports = function (context) {
    var connect = require('connect');

    var app = connect();

    if (context.CONSOLE_ENABLED) {
        app.use(connect.logger({
            format: 'dev'
        }));
    }
    (context.middlewares || []).forEach(function (middleware) {
        app.use(middleware);
    });

    return http.createServer(app);
};

