http_server_cli 1.0.0+4

  • Readme
  • Changelog
  • Example
  • Installing
  • new50

http_server_cli #

http_server_cli is a simple, zero-configuration command-line http server. It is highly inspired by node js http-server. Internally it uses dart http_server

Installation #

If you want to use http_server_cli on the command line, install it using pub global activate:

pub global activate http_server_cli

How to run #

pub run http_server_cli

Extra options #

pub run http_server_cli --port 9000 --path ./test/public --not-found index.html --no-dir -s

Available Options/Flags: #

-p or --port Port to use (defaults to 8080) -N or --not-found Page Not Found to use (defaults to '404.html') -a Address to use (defaults to 0.0.0.0)

-d Show directory listings (defaults to true), --no-dir for false

-i Display autoIndex (defaults to true) --no-index for false

-s or --silent Suppress log messages from output(defaults to false)

-h or --help Print this list and exit.

Features Coming soon #

--cors Enable CORS via the Access-Control-Allow-Origin header

-o [path] Open browser window after starting the server. Optionally provide a URL path to open. e.g.: -o /other/dir/

-c Set cache time (in seconds) for cache-control max-age header, e.g. -c10 for 10 seconds (defaults to 3600). To disable caching, use -c-1.

-U or --utc Use UTC time format in log messages.

--log-ip Enable logging of the client's IP address (default: false).

-P or --proxy Proxies all requests which can't be resolved locally to the given url. e.g.: -P http://someurl.com

--username Username for basic authentication [none]

--password Password for basic authentication [none]

-S or --ssl Enable https.

-C or --cert Path to ssl cert file (default: cert.pem).

-K or --key Path to ssl key file (default: key.pem).

-r or --robots Provide a /robots.txt (whose content defaults to User-agent: *\nDisallow: /)

1.0.0+4 #

1.0.0+3 #

1.0.0+2 #

1.0.0+1 #

1.0.0 #

example/README.md

Installation #

If you want to use http_server_cli on the command line, install it using pub global activate:

pub global activate http_server_cli

How to run[Basic]

pub run http_server_cli

Extra options #

pub run http_server_cli --port 9000 --path ./test/public --not-found index.html --no-dir -s

Use this package as an executable

1. Install it

You can install the package from the command line:


$ pub global activate http_server_cli

2. Use it

The package has the following executables:


$ http_server_cli

Use this package as a library

1. Depend on it

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


dependencies:
  http_server_cli: ^1.0.0+4

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:http_server_cli/server.dart';
import 'package:http_server_cli/util.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
50
Learn more about scoring.

We analyzed this package on Oct 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, other

Platform components identified in package: io.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
args ^1.5.2 1.5.2
http_server ^0.9.8+3 0.9.8+3
Transitive dependencies
mime 0.9.6+3
path 1.6.4
Dev dependencies
test ^1.5.1