app/App.js
/**
   *  Validates a request method against a route and will throw a method not
   *  allowed error if the method is not allowed.
   *
   *  @param {Request} req Express request
   *  @param {Route} route
   *  @param {array} routes All routes
   *  @throws {Error} If method is not allowed
   *  @return {void}
   */
Validates a request method against a route and will throw a method not
allowed error if the method is not allowed.


Validates a request method against a route and will throw a method not allowed error if the method is not allowed .
validateRequestMethod(req, route, routes) {
    let availableMethods = routes.filter((r) => r.path === route.path).map((r) => r.httpMethod.toUpperCase());
    if(availableMethods.indexOf(req.method.toUpperCase()) < 0) {
      let error = new Error();
      error.code = 405;
      error.status = 405;
      error.methodsAllowed = availableMethods;
      throw error;
    }
  }
validateRequestMethod ( req , route , routes ) { let availableMethods = routes . filter ( ( r ) => r . path === route . path ) . map ( ( r ) => r . httpMethod . toUpperCase ( ) ) ; if ( availableMethods . indexOf ( req . method . toUpperCase ( ) ) < 0 ) { let error = new Error ( ) ; error . code = 405 ; error . status = 405 ; error . methodsAllowed = availableMethods ; throw error ; } }
Validates a request method against a route and will throw a method not
  allowed error if the method is not allowed.
Validates a request method against a route and will throw a method not allowed error if the method is not allowed .