setupRouteHandler = (shim, fastify) => {
  fastify.addHook('onRoute', (routeOptions) => {
    if (!routeOptions.handler) {
      return
    }
    /**
     * recordMiddleware handler call
     *
     * The WebFramework shim treats the main route handler like any other
     * i.e. dont be confused by the call to recordMiddleware -- we don't
     * have a recordRouteHandler, everything goes through recordMiddleware
     */
    const newRouteHandler = shim.recordMiddleware(
      routeOptions.handler,
      buildMiddlewareSpecForRouteHandler(shim, routeOptions.path)
    )

    routeOptions.handler = newRouteHandler
  })

  shim.wrap(fastify, 'addHook', function addWrapHook(shim, fn) {
    return function wrappedAddHook(...args) {
      const hookName = args[0]
      if (REQUEST_HOOKS.includes(hookName)) {
        const middlewareFunction = args[1]
        const name = `${hookName}/${shim.getName(middlewareFunction)}`
        const middlewareSpec = buildMiddlewareSpecForMiddlewareFunction(shim, name)
        const newMiddlewareFunction = shim.recordMiddleware(middlewareFunction, middlewareSpec)

        args[1] = newMiddlewareFunction
      }
      return fn.apply(this, args)
    }
  })
}
Sets up fastify route handler

Fastify's onRoute hook will fire whenever
a route is registered.  This is the most straight
forward way to get at a fastify route definition.
Not only are we _not_ relying on private implementations
that could change, fastify is pretty good about protecting
those private implementations from access, and getting
at them would require a lot of gymnastics and hard to
maintain code

@param shim
@param fastify