dartnet 0.3.0

Dartnet #

Configurable http server in dart.

  • [ ] For production server
  • [ ] For dev server (pub serve proxy)

Install #

pub global activate dartnet

Usage #

dartnet

or

pub run dartnet:dartnet

Commands #

Usage 'dartnet' :
        -c, --config    (defaults to "dartnet.yaml")
        -h, --help      

COMMANDS:
        init    Create config file with default value.
                -f, --filename    (defaults to "dartnet.yaml")
        dockerize       Create a Dockerfile from the Dartnet config file
                -f, --filename    (defaults to "dartnet.yaml")

Configuration #

Dartnet use a configuration file (default: 'dartnet.yaml')

Basic #

address: "0.0.0.0"
port: 1337
root_directory: build

This will serve all file under the 'build' directory.

Complete #

address: "0.0.0.0" #default: 0.0.0.0

port: 1337 #default: 8080

root_directory: web #default: build

multithread: true #default: true

log: info #default: info

log_file: "dartnet.log" #default: dartnet.log

list_directory: false #default: false

gzip: true #default: true

redirections:
  path:
    /: "index.html" #default behavior
    /redirect: "https://www.google.com"
    /**: "index.html"
  404: error.html
    
https:
  cert: ssl/cert.pem
  key: ssl/key.pem
  password_key: "dartnet"

Run example #

cd example
dartnet

Changelog #

0.3.0 #

  • dart 2 sdk

0.2.0 #

  • Implement Path redirection
  • Config for redirections change, see example in README
  • Add dartnet dockerize command

0.1.2 #

  • update Jaguar ro 0.4.0

0.1.1 #

  • dartnet init command: create the default config file

0.1.0 #

  • Change configuration file, remove "server" key
  • Add gzip compression

0.0.2 #

  • Add SSL

0.0.1 #

  • Initial version, created by Stagehand

Use this package as an executable

1. Install it

You can install the package from the command line:


$ pub global activate dartnet

2. Use it

The package has the following executables:


$ dartnet

Use this package as a library

1. Depend on it

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


dependencies:
  dartnet: ^0.3.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:dartnet/dartnet.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
89
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
43
Learn more about scoring.

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

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: other

Primary library: package:dartnet/dartnet.dart with components: io, isolate, mirrors.

Health issues and suggestions

Document public APIs. (-1 points)

51 out of 51 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/utils.dart. (-6.31 points)

Analysis of lib/src/utils.dart reported 13 hints, including:

line 37 col 5: DO use curly braces for all flow control structures.

line 126 col 37: 'HOST' is deprecated and shouldn't be used.

line 130 col 37: 'VIA' is deprecated and shouldn't be used.

line 153 col 36: 'VIA' is deprecated and shouldn't be used.

line 157 col 42: 'TRANSFER_ENCODING' is deprecated and shouldn't be used.

Fix lib/src/server.dart. (-1.99 points)

Analysis of lib/src/server.dart reported 4 hints:

line 9 col 1: The class 'Future' was not exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions.

line 9 col 38: Use = to separate a named parameter from its default value.

line 43 col 37: Use = to separate a named parameter from its default value.

line 54 col 32: Use = to separate a named parameter from its default value.

Fix lib/src/config.dart. (-1 points)

Analysis of lib/src/config.dart reported 2 hints:

line 13 col 20: Avoid using null in if null operators.

line 37 col 46: Use = to separate a named parameter from its default value.

Fix lib/src/logger.dart. (-0.50 points)

Analysis of lib/src/logger.dart reported 1 hint:

line 18 col 55: 'APPEND' is deprecated and shouldn't be used.

Maintenance suggestions

The package description is too short. (-20 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.

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

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

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
ansicolor ^1.0.2 1.0.2
args ^1.5.1 1.5.2
jaguar ^2.4.0 2.4.36
logging ^0.11.3+2 0.11.3+2
mustache ^1.0.2 1.1.1
path ^1.6.2 1.6.2
resource ^2.1.5 2.1.6
yaml ^2.1.15 2.1.16
Transitive dependencies
auth_header 2.1.4
charcode 1.1.2
collection 1.14.11
convert 2.1.1
crypto 2.0.6
http_server 0.9.8+3
jaguar_common 2.1.4
jaguar_serializer 2.2.12
meta 1.1.7
mime 0.9.6+3
path_tree 2.2.2
source_span 1.5.5
stack_trace 1.9.3
string_scanner 1.0.4
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
test ^1.3.0

Admin