def endpoint(path)
      normalized = normalize_path_info(path)

      fullpath = File.join(@root, normalized)
      endpoint = if FileTest.file?(fullpath)
                   fullpath
                 elsif needs_redirect_to_dir?(fullpath)
                   :must_redirect
                 elsif FileTest.file?(fullpath_html = "#{fullpath}.html")
                   fullpath_html
                 else
                   :not_found
                 end

      endpoint
    end
def endpoint(path)
      normalized = normalize_path_info(path)

      fullpath = File.join(@root, normalized)
      endpoint = if FileTest.file?(fullpath)
                   fullpath
                 elsif needs_redirect_to_dir?(fullpath)
                   :must_redirect
                 elsif FileTest.file?(fullpath_html = "#{fullpath}.html")
                   fullpath_html
                 else
                   :not_found
                 end

      endpoint
    end
Creates a Router for the given root directory.
 Returns the full file system path of the file corresponding to
 the given URL +path+, or

 - +:must_redirect+ if the request must be redirected to +path/+,
 - +:not_found+ if no corresponding file exists.

 The return value is found as follows:

 1. a +path/+ with a trailing slash is changed to +path/index.html+,
 2. then, the method checks for an exactly corresponding file,
 3. when +path+ does not exist but +path/index.html+ does,
    a redirect will be indicated,
 4. finally, when no exactly corresponding file or redirect
    can be found, +path.html+ is tried.