You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: routes_custom.go
    path of file: ./repos/stash/internal/api
    
    the code of the file until where you have to start completion: package api

import (
	"net/http"
	"strings"

	"github.com/go-chi/chi/v5"
	"github.com/stashapp/stash/pkg/utils"
)

type customRoutes struct {
	servedFolders utils.URLMap
}

func getCustomRoutes(servedFolders utils.URLMap) chi.Router {
	return customRoutes{servedFolders: servedFolders}.Routes()
}

func (rs customRoutes) Routes
    
func (rs customRoutes) Routes() chi.Router {
	r := chi.NewRouter()

	r.HandleFunc("/*", func(w http.ResponseWriter, r *http.Request) {
		r.URL.Path = strings.Replace(r.URL.Path, "/custom", "", 1)

		// http.FileServer redirects to / if the path ends with index.html
		r.URL.Path = strings.TrimSuffix(r.URL.Path, "/index.html")

		// map the path to the applicable filesystem location
		var dir string
		r.URL.Path, dir = rs.servedFolders.GetFilesystemLocation(r.URL.Path)
		if dir != "" {
			http.FileServer(http.Dir(dir)).ServeHTTP(w, r)
		} else {
			http.NotFound(w, r)
		}
	})

	return r
}