index.js 652 Bytes
var path = require('path');
var IoC = require('electrolyte');
var bootable = require('./bootable');
var express = require('express');

process.chdir(__dirname);
//依赖注入
IoC.use(IoC.dir(path.join(__dirname, 'boot')));
IoC.use('igloo', require('./igloo'));


var app = bootable(express());

app.phase(bootable.di.initializers());
app.phase(bootable.di.routes('./routes'));

IoC.create('igloo/server').then(function (server) {
    app.phase(server);
    // app.boot(function (err) {

    //     if (err) {
    //         console.log(err);
    //         process.exit(-1);
    //         return;
    //     }

    // });
});



module.exports = app;