 genericRoutes = require './engine'
 _ = require('underscore')
 
-cors = require('cors')
 
 ###
 Exemple:

            @app[route.method]("#{@baseURI}#{route.url}", route.func)


    getDatabase: () ->
        unless @config.database?
            throw 'EurekaServer: database is required'


    constructor: (@config) ->

        if not @config.name
            throw 'EurekaServer: name is required'
        @apiVersion = @config.version or 1
        @baseURI = @config.baseURI or "/api/#{config.version}"
        @applicationName = @config.name
        @db = @getDatabase()

        @app = express()
        @registerMiddlewares()


        routesAdded = []
        routes = []

        # add the custom routes
        if @config.customRoutes
            customRoutes = _.sortBy(@config.customRoutes, 'url').reverse()
            for route in customRoutes
                routes.push(route)
                routesAdded.push(route.url)
