/**
 * Module dependencies.
 */

const config = require('lib/config')
const express = require('express')
const errorhandler = require('errorhandler')
const path = require('path')
const favicon = require('serve-favicon')
const translations = require('lib/translations')
const t = require('t-component')

const app = module.exports = express()

/**
 * Set `views` directory for module
 */

app.set('views', __dirname)

/**
 * Set `view engine` to `jade`.
 */

app.set('view engine', 'jade')

/**
 * middleware for favicon
 */

app.use(favicon(path.join(__dirname, '/assets/favicon.ico')))

/*
 * Register Models and Launch Mongoose
 */

require('lib/models')(app)

/**
 * Set `app` configure settings
 */

require('lib/setup')(app)

/*
 * PassportJS Auth Strategies and Routes
 */

require('lib/auth')(app)

/*
 * Load /ext folder
 */

app.use(require('lib/ext'))

/*
 * Twitter card routes
 */

app.use('/twitter-card', require('lib/twitter-card'))

/*
 * Facebook card routes
 */

app.use('/facebook-card', require('lib/facebook-card'))

/*
 * Load v2 api endpoints
 */

app.use('/api/v2', require('lib/api-v2/boot'))

/*
 * Load api endpoints
 */

app.use(require('lib/api/boot'))

/*
 * RSS routes
 */

app.use('/rss', require('lib/rss'))

/**
 * Load localization dictionaries to translation application
 */

translations.help(t)

/**
 * Init `t-component` component with parameter locale
 */

t.lang(config.locale)

/**
 * Load Styleguide
 */
if (config.env !== 'production') {
  app.use(require('lib/styleguide'))
}

/**
 * GET index page.
 */

app.use(require('lib/browser-update'))

app.use(require('lib/settings/boot'))
app.use(require('lib/admin/boot'))
app.use(require('lib/site/boot'))

app.use(require('lib/404'))

/**
 * Set native `express` error handler
 */

if ('development' === config.env) {
  // only use in development
  app.use(errorhandler())
}

@@ -1,49 +1,14 @@
-/**%0A * Module dependencies.%0A */%0A%0Aconst config
+const path
  = r
@@ -19,18 +19,12 @@
 re('
-lib/config
+path
 ')%0Ac
@@ -106,37 +106,8 @@
 r')%0A
-const path = require('path')%0A
 cons
@@ -143,16 +143,86 @@
 vicon')%0A
+const t = require('t-component')%0Aconst config = require('lib/config')%0A
 const tr
@@ -265,41 +265,8 @@
 ns')
-%0Aconst t = require('t-component')
 %0A%0Aco
@@ -1493,23 +1493,23 @@
 %0A * 
-GET index page.
+Front End Pages
 %0A */
@@ -1545,25 +1545,24 @@
 r-update'))%0A
-%0A
 app.use(requ
@@ -1656,17 +1656,16 @@
 boot'))%0A
-%0A
 app.use(
@@ -1740,36 +1740,36 @@
 if (
-'development' === config.env
+config.env === 'development'
 ) %7B%0A

fix js styles