dhttpd 3.0.1

  • Readme
  • Changelog
  • Installing
  • 72

Build Status

A simple HTTP server that can serve up any directory, built with Dart. Inspired by python -m SimpleHTTPServer.

Install #

Use the pub global command to install this into your system.

$ 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 pub global command.

$ pub global run dhttpd

Here's an example of creating a web app with Stagehand and then running it with this server:

$ stagehand web-angular
$ pub get
$ pub build
$ dhttpd --path build/web/  # Serves app at http://localhost:8080

Configure #

$ dhttpd --help
-p, --port=<port>    The port to listen on.
                     (defaults to "8080")

    --path=<path>    The path to serve. If not set, the curret directory is used.
    --host=<host>    The hostname to listen on.
                     (defaults to "localhost")

-h, --help           Displays the help.

3.0.1 #

  • Updated a number of dependencies.

3.0.0 #

  • Set Dart SDK constraint to '>=2.0.0-dev.48.0 <3.0.0'.
  • Removed top-level fields DEFAULT_PORT and DEFAULT_HOST from library.

2.0.0 #

  • Removed allow-origin flag. In reality, this flag never worked because the shelf pipeline was not configured correctly.

  • Source moved to github.com/kevmoo/dhttpd.

1.0.0 #

  • No change in functionality, just version and doc tweaks.

0.3.1 #

  • Fixed bug with setting the path from the command line.
  • Start the server with dhttpd.

0.3.0 #

  • New host command-line flag, to set the hostname to listen on. Defaults to localhost

0.2.0 #

  • New allow-origin command-line flag for CORS headers. Thanks to @gmosx for the patch.

Use this package as an executable

1. Install it

You can install the package from the command line:

$ pub global activate dhttpd

2. Use it

The package has the following executables:

$ dhttpd

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  dhttpd: ^3.0.1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:dhttpd/dhttpd.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jan 20, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4

Health issues and suggestions

Document public APIs. (-1 points)

8 out of 8 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/options.g.dart. (-1.49 points)

Analysis of lib/src/options.g.dart reported 3 hints:

line 11 col 11: Unnecessary new keyword.

line 14 col 52: Unnecessary new keyword.

line 36 col 52: Unnecessary new keyword.

Fix lib/dhttpd.dart. (-0.50 points)

Analysis of lib/dhttpd.dart reported 1 hint:

line 31 col 12: Unnecessary new keyword.

Maintenance suggestions

Package is getting outdated. (-23.84 points)

The package was last published 64 weeks ago.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and dhttpd.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

The package description is too short. (-7 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
args >=0.12.0+1 <2.0.0 1.5.2
build_cli_annotations ^1.0.0 1.1.0
shelf ^0.7.2 0.7.5
shelf_static ^0.2.0 0.2.8
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.12
convert 2.1.1
http_parser 3.1.3
meta 1.1.8
mime 0.9.6+3
source_span 1.6.0
stack_trace 1.9.3
stream_channel 2.0.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
build_cli ^1.0.0
build_runner ^1.0.0
build_verify ^1.0.0
path ^1.6.1 1.6.4
pedantic ^1.3.0
test ^1.3.0
test_process ^1.0.1