import express from 'express'
<%_ if (https) { _%>
import forceSSL from 'express-force-ssl'
<%_ } _%>
import cors from 'cors'
import compression from 'compression'
import morgan from 'morgan'
import bodyParser from 'body-parser'
import methodOverride from 'method-override'
import { errorHandler as queryErrorHandler } from 'querymen'
import { errorHandler as bodyErrorHandler } from 'bodymen'
import { env } from './'

export default (routes) => {
  const app = express()

  <%_ if (https) { _%>
  /* istanbul ignore next */
  if (env === 'production') {
    app.set('forceSSLOptions', {
      enable301Redirects: false,
      trustXFPHeader: true
    })
    app.use(forceSSL)
  }

  <%_ } _%>
  /* istanbul ignore next */
  if (env === 'production' || env === 'development') {
    app.use(cors())
    app.use(compression())
    app.use(morgan('dev'))
  }

  app.use(bodyParser.urlencoded({ extended: false }))
  app.use(bodyParser.json())
  app.use(methodOverride())
  app.use(routes)
  app.use(queryErrorHandler())
  app.use(bodyErrorHandler())

  return app
}

@@ -226,53 +226,8 @@
 er'%0A
-import methodOverride from 'method-override'%0A
 impo
@@ -893,36 +893,8 @@
 ())%0A
-  app.use(methodOverride())%0A
   ap

Remove method-override