dhttpd는 Flutter용으로 제작된 가벼운 정적 HTTP 파일 서버로, 디렉터리 내용을 쉽게 로컬에서 호스팅할 수 있도록 해줍니다. 개발자는 지정된 디렉터리에서 HTTP를 통해 파일을 제공할 수 있으며, 웹 자산 테스트, 정적 사이트 제공 또는 개발 중 로컬 파일 공유에 이상적입니다. 이 서버는 Android, iOS, macOS, Windows, Linux 등 여러 플랫폼에서 작동하여 크로스플랫폼 워크플로우에 유연하게 활용할 수 있습니다. 최소한의 설정으로 복잡한 구성 없이 콘텐츠를 미리 보기 또는 공유할 수 있는 간단한 방법을 제공합니다.
사용 사례
로컬 개발 미리보기
정적 웹 자산 제공
웹 애플리케이션 테스트
장치 간 파일 공유
빠른 프로토타이핑
주요 기능
간단한 설정
크로스 플랫폼 지원
정적 파일 서빙
Lightweight
모든 주요 플랫폼에서 실행됩니다
적합한 대상
Flutter 개발자
프론트엔드 테스터
로컬 웹 서버 필요
Prototyping
개발 환경
고려 사항
생산 환경 사용을 위한 것이 아님
정적 파일에 한정
인증되지 않음
고급 설정을 위해 수동 구성이 필요합니다
동적 콘텐츠에 적합하지 않습니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
A simple HTTP server that can serve up any directory, built with Dart. Inspired
by python -m SimpleHTTPServer.
Install
Use the dart pub global command to install this into your system.
$ dart pub global activate dhttpd
Use
If you have modified your PATH, you can run this server from any local
directory.
$ dhttpd
Otherwise you can use the dart pub global command.
$ dart pub global run dhttpd
Here's an example of creating a web app and then running it with this server:
$ dart create -t web web_app
$ cd web_app
$ dart pub get
$ dart run build_runner build -o build
$ dhttpd --path build/web/ # Serves app at http://localhost:8080
HTTPS
If you want to use HTTPS you will need to pass in the path of the SSL
certificate and the SSL key file as well as the password string, if a password
is set on the key, for example:
$ dart bin/dhttpd.dart --sslcert=example/server_chain.pem --sslkey=example/server_key.pem --sslkeypassword=dartdart
Server HTTPS started on port 8080
$ dhttpd --help
--headers=<headers> HTTP headers to apply to each response. Can be used multiple times. Format: header=value;header2=value
--host=<host> The hostname to listen on.
(defaults to "localhost")
-l, --list-files List the files in the directory if no index.html is present.
--path=<path> The path to serve. If not set, the current directory is used.
-p, --port=<port> The port to listen on. Provide `0` to use a random port.
(defaults to "8080")
-q, --quiet Disable logging.
--sslcert=<sslcert> The SSL certificate to use. Also requires sslkey
--sslkey=<sslkey> The key of the SSL certificate to use. Also requires sslcert
--sslkeypassword=<sslkeypassword> The password for the key of the SSL certificate to use.
-h, --help Displays the help.
--version Prints the version of dhttpd.