Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
func Run(r *chi.Mux, urlPath string, fs http.FileSystem, stripPrefix string, cacheMaxAgeSeconds int)
Run sets up a handler on the given Chi router to serve static files. It allows for configurable caching and uses a custom 404 error handler.
Run은 정적 파일을 제공하기 위해 주어진 Chi 라우터에 핸들러를 설정합니다. 캐싱을 설정할 수 있으며 사용자 정의 404 오류 핸들러를 사용합니다.
Parameters:
- r: The Chi router.
- r: Chi 라우터입니다.
- urlPath: The URL path to serve files from (e.g., "/static").
- urlPath: 파일을 제공할 URL 경로입니다 (예: "/static").
- fs: The http.FileSystem to serve files from.
- fs: 파일을 제공할 http.FileSystem입니다.
- stripPrefix: A prefix to be added to the file path inside the http.FileSystem.
- stripPrefix: http.FileSystem 내부의 파일 경로에 추가될 접두사입니다.
- cacheMaxAgeSeconds: Caching duration in seconds.
- > 0: Sets "Cache-Control: public, max-age=<value>".
- < 0: Sets "Cache-Control: no-store".
- == 0: Caching is disabled (no header is set).
- cacheMaxAgeSeconds: 캐시 기간(초)입니다.
- > 0: "Cache-Control: public, max-age=<값>"을 설정합니다.
- < 0: "Cache-Control: no-store"를 설정합니다.
- == 0: 캐싱이 비활성화됩니다 (헤더가 설정되지 않음).
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.