     @param {Route} route The route the endpoints belong to
     @param {Endpoint} endpoint The endpoint to configure
   ###
-  _configureEndpoints = (route) ->
-    _.each route.endpoints, (endpoint) ->
+  _configureEndpoints: ->
+    _.each @endpoints, (endpoint) ->
         # Configure acceptable roles
-      if not route.options?.roleRequired
-        route.options.roleRequired = []
+      if not @options?.roleRequired
+        @options.roleRequired = []
       if not endpoint.roleRequired
         endpoint.roleRequired = []
-      endpoint.roleRequired = _.union endpoint.roleRequired, route.options.roleRequired
+      endpoint.roleRequired = _.union endpoint.roleRequired, @options.roleRequired
       # Make it easier to check if no roles are required
       if _.isEmpty endpoint.roleRequired
         endpoint.roleRequired = false
 
       # Configure auth requirement
-      if not route.api.config.useAuth
+      if not @api.config.useAuth
         endpoint.authRequired = false
       else if endpoint.authRequired is undefined
-        if route.options?.authRequired or endpoint.roleRequired
+        if @options?.authRequired or endpoint.roleRequired
           endpoint.authRequired = true
         else
           endpoint.authRequired = false
-
+      return
+    , this
     return
 
 

    @context: IronRouter.Router.route()
    @returns The endpoint response or a 401 if authentication fails
  ###
  _callEndpoint = (route, endpoint) ->
    # Call the endpoint if authentication doesn't fail
    if _authAccepted.call this, route, endpoint
      if _roleAccepted.call this, route, endpoint
        endpoint.action.call this
      else
        statusCode: 401
        body: {success: false, message: "You do not have permission to do this."}

    @context: IronRouter.Router.route()
    @returns {Boolean} True if the authentication was successful
  ###
  _authenticate: (endpointContext) ->
    # Get the auth info from header
    userId = endpointContext.request.headers['x-user-id']
    authToken = endpointContext.request.headers['x-auth-token']

    # Get the user from the database
    if userId and authToken
