function attach(path, handler, target) {
  const sanitized = path[path.length - 1] === "/" ? path.slice(0, -1) : path;

  if (!attachParts(sanitized.split("/"), handler, target)) {
    throw kerror.get("duplicate_url", sanitized);
  }
}
Attach a handler to an path and stores it to the target object

@param {string} path
@param {Function} handler
@param {RoutePart} target