dartnet 0.3.0

  • Readme
  • Changelog
  • Installing
  • 39

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]
76
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
79
Overall:
Weighted score of the above. [more]
39
Learn more about scoring.

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

  • Dart: 2.6.1
  • pana: 0.12.21

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. (-8.63 points)

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

line 7 col 39: Avoid const keyword.

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

line 50 col 10: Unnecessary new keyword.

line 95 col 10: Unnecessary new keyword.

line 112 col 22: Unnecessary new keyword.

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

Analysis of lib/src/config.dart reported 14 hints, including:

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.

line 38 col 12: Unnecessary new keyword.

line 39 col 26: Unnecessary new keyword.

line 41 col 23: Unnecessary new keyword.

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

Analysis of lib/src/server.dart reported 10 hints, including:

line 9 col 1: The class 'Future' wasn't 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 11 col 15: Unnecessary new keyword.

line 18 col 18: Unnecessary new keyword.

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

Fix additional 3 files with analysis or formatting issues. (-5.45 points)

Additional issues in the following files:

  • lib/src/logger.dart (6 hints)
  • bin/dartnet.dart (3 hints)
  • lib/src/handler.dart (2 hints)

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.

Package is getting outdated. (-0.55 points)

The package was last published 52 weeks ago.

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.4
resource ^2.1.5 2.1.6
yaml ^2.1.15 2.2.0
Transitive dependencies
auth_header 2.1.4
charcode 1.1.2
collection 1.14.12
convert 2.1.1
crypto 2.1.4
http_server 0.9.8+3
jaguar_common 2.1.4
jaguar_serializer 2.2.12
meta 1.1.8
mime 0.9.6+3
path_tree 2.2.2
source_span 1.5.5
stack_trace 1.9.3
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
test ^1.3.0