bulls_eye 0.3.0-alpha

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 2

Bulls-Eye

Build Status

Bull's Eye is a Dart-IO Web Application Framework (like Express on Node.js). It should bring the speed of Dart to the server-side. To have an single language to program server and client.

Feature Tour

![Example Workflow](/doc/Server/img/Bulls-Eye-Server - Middleware.png)

Bulls-Eye on Dart Package Manager

Install

You can get Bulls-Eye from the Dart Pub Manager.<br/> Get the Package

  • Add the dependancy 'bulls_eye' to your pubspec.yaml
  • Via the DartEditor dialog
  • By adding the following to the file:
    dependencies:
        bulls_eye: any
    
  • Update your depandancies by running pub install

Use the Package

import 'package:bulls_eye/common.dart'; // For URL defenition
import 'package:bulls_eye/server.dart'; // For using the web server

Example


// URL part definition incl. Validation rules
var todo = new Static("todo");
var listID = new Variable("ListID", extensions: { ValidationKey: isInt }); // Define the validation rule for the variable to be handled by the validation middleware
var itemID = new Variable("ItemID", isOptional: true, extensions: { ValidationKey: isInt }); // Define the validation rule for the variable to be handled by the validation middleware

// Route defenition
var jsPath = new Url("js/*"); // Add a wildcard '*' to match all routes they start with the defined route
var cssPath = new Url("css/*");
var home = new Url("");
var toDoListItemUrl = new Url.fromObj([todo, listID, itemID]); // use the URL Parts in several routes
var searchUrl = new Url("search?q&(MaxResults)"); // Define query variables 'q' and optional query variables 'MaxResults'

// Create Server
var server = new Server();

// Middleware
// Add complex middleware combinations which can be executed before, around and/or after the route logic.
server.middleware("PublicArea")..add(new Validation())
                                ..around((context) { /* e.g. loging */ })
                                ..after((context) { /* e.g. post processing */ });

server.middleware("SecureArea")..add(new Validation())
								..before((context) { /* e.g. Auth */ })
                                ..around((context) { /* e.g. loging */ })
                                ..after((context) { /* e.g. post processing */ });
// ... define more middleware combination if you need

// Define Routes
server..route("GET", cssPath, new LoadFile.fromUrl(basePath: "x:/project/css/"), contentTypes: ["text/css"]) // Only CSS allowed
      ..route("GET", jsPath, new LoadFile.fromUrl(basePath: "x:/project/js/")) // defining an optional basePath (basepath + wildcard = filepath)

      ..route("GET", home, new LoadFile.fromPath("client/home.html"), middleware: "PublicArea") // Use the middleware for public access

      ..route("GET", toDoListItemUrl, new ExecuteCode((context) {
      	//Logic to execute here
      }), middleware: "SecureArea"); // Use the middleware for secure access

      ..route("POST", toDoListItemUrl, new ExecuteCode((context) {
      	//Logic to execute here
      }), middleware: "SecureArea", extensions: { BodyValidatorKey: isJSON }); // Validate the body an check if it is a JSON body

      ..route("GET", searchUrl, new ExecuteCode((context) {
      	// Search logic to execute here
      }), middleware: "SecureArea"); // Use the middleware for secure access

// Start Server
server.start();

Documentation

Feature Tour

The Lib is devided into 3 parts:

To get an idea of the state, take a look at the example, doc and/or the tests.

Changelog

See here

Roadmap

See here

Targets

Building a Web Application Framework specialize for RESTful, Webservices and SinglePage WebApplications.

It should be:

  • extendable
  • easy
  • secure
  • and fast

FAQ

Why not using an available implementation?

I know there are some projects out there which doing the same. But I want to build a server which fits more my needs and implements some features I missed on other implementations. <br/>

#Changelog

DateFormat: DD.MM.YYYY
Legend: (NEW) New Feature - (IMP) Improvement - (FIX) Bugfix - (!!!) Attantion (e.g. Breaking Changes)

##Version 0.3.0-Alpha **Release date: 27 Feb 2014 **


  • (!!!) Changed constructor optional parameter of Variable from positional to named
  • (!!!) Changed constructor optional parameter of QVariable from positional to named
  • (!!!) Changed property varName of Variable and QVariable to name
  • (!!!) Changed property routeParts of Url to pathParts
  • (!!!) The ReqResContext was complete rewritten
  • **(!!!) Renamed the Constructor fromUrl of the LoadFile route logic to fromWildcard to see better what it did **

  • (NEW) (#7) Add a validation engine with predefined validators
  • (IMP) The ReqResContext was complete rewritten
  • (IMP) (#5) Add a base path as named parameter to the LoadFile.fromWildcard Route logic

##Version 0.2.0-Alpha **Release date: 05 Feb 2014 **


  • (!!!) Class RouteDef was renamed in Url

  • (!!!) Class RoutePart was renamed in PathPart

  • (!!!) Class RouteDefConfig was renamed in UrlDefConfig

  • (!!!) Class UriMatcher was renamed in UrlMatcher

  • (!!!) Class LogicRoute was renamed in ExecuteCode and refactored

  • (!!!) Class FileRoute was renamed in LoadFile and refactored

  • (!!!) Method RegisterRoute of the class Server was renamed in route and gots a new parameter order:

    // Old
    server.RegisterRoute(new FileRoute.fromUri(jsPath, methods: ["GET"]));
    // New - better readability
    server.route("GET", jsPath, new LoadFile.fromUrl());
    
  • (!!!) (#4) Renamed the Common-Lib import from package:bulls_eye/BullsEyeCommon/bulls_eye_common.dart to package:bulls_eye/common.dart

  • (!!!) (#4) Renamed the Server-Lib import from package:bulls_eye/BullsEyeCommon/bulls_eye_server.dart to package:bulls_eye/server.dart


  • (NEW) Add Middleware
  • (IMP) Add funxtion exception to Server object for custom exception handling
  • (IMP) Documentation
  • (FIX) A Problem with extracting variables from URLs with only required variables (Route and Query)

##Version 0.1.0-Alpha **Release date: 05 Jan 2014 **

  • (NEW) Add Route Defenition Structures
  • (NEW) Add Route-Variable Replacing
  • (NEW) Add Route-Variable Extracting
  • (NEW) Add Route-Matching
  • (NEW) Add WebServer
  • (NEW) Add Server-Side Routing

Use this package as a library

1. Depend on it

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


dependencies:
  bulls_eye: ^0.3.0-alpha

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:bulls_eye/client.dart';
import 'package:bulls_eye/common.dart';
import 'package:bulls_eye/server.dart';
  
Version Uploaded Documentation Archive
0.3.0-alpha Feb 27, 2014 Go to the documentation of bulls_eye 0.3.0-alpha Download bulls_eye 0.3.0-alpha archive
0.2.0-alpha Feb 5, 2014 Go to the documentation of bulls_eye 0.2.0-alpha Download bulls_eye 0.2.0-alpha archive
0.1.0-alpha Jan 7, 2014 Go to the documentation of bulls_eye 0.1.0-alpha Download bulls_eye 0.1.0-alpha archive
0.0.1-alpha Jan 5, 2014 Go to the documentation of bulls_eye 0.0.1-alpha Download bulls_eye 0.0.1-alpha archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
7
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
2
Learn more about scoring.

We analyzed this package on Sep 18, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.3

Platforms

Detected platforms: unsure

Low code quality prevents platform classification.

Issues and suggestions

Fix platform conflicts.

Low code quality prevents platform classification.

Fix lib/src/Common/UrlDefenition/url_matcher.dart.

Analysis of lib/src/Common/UrlDefenition/url_matcher.dart failed with 6 errors, 5 hints, including:

line 32 col 89: The argument type 'PathPart' can't be assigned to the parameter type 'VariableInfo'.

line 38 col 87: The argument type 'QueryPart' can't be assigned to the parameter type 'VariableInfo'.

line 44 col 91: The argument type 'PathPart' can't be assigned to the parameter type 'VariableInfo'.

line 46 col 106: The argument type 'QueryPart' can't be assigned to the parameter type 'VariableInfo'.

line 262 col 61: The getter 'name' isn't defined for the class 'Object'.

Fix lib/src/Server/Middleware/Validation/ValidationEngine.dart.

Analysis of lib/src/Server/Middleware/Validation/ValidationEngine.dart failed with 1 error, 6 hints, including:

line 97 col 60: The getter 'isValid' isn't defined for the class 'InputData'.

line 20 col 3: This function declares a return type of 'Future', but doesn't end with a return statement.

line 44 col 11: The value of the local variable 'onInvalid' isn't used.

line 48 col 14: The value of the local variable 'isValid' isn't used.

line 49 col 13: The value of the local variable 'data' isn't used.

Fix lib/src/Server/input_data.dart.

Analysis of lib/src/Server/input_data.dart failed with 1 error:

line 41 col 1: The class '_UrlInputData' cannot implement both 'InputData<ValueType>' and 'InputData<dynamic>' because the type arguments are different.

Fix additional 27 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/Server/read_only_map.dart (1 error)
  • lib/common.dart (Run dartfmt to format lib/common.dart.)
  • lib/src/Common/Extensions/version_path_part.dart (Run dartfmt to format lib/src/Common/Extensions/version_path_part.dart.)
  • lib/src/Common/UrlDefenition/path_parts.dart (Run dartfmt to format lib/src/Common/UrlDefenition/path_parts.dart.)
  • lib/src/Common/UrlDefenition/query_parts.dart (Run dartfmt to format lib/src/Common/UrlDefenition/query_parts.dart.)
  • lib/src/Common/UrlDefenition/url.dart (1 hint)
  • lib/src/Common/UrlDefenition/url_def_config.dart (Run dartfmt to format lib/src/Common/UrlDefenition/url_def_config.dart.)
  • lib/src/Common/Validation/bool_validators.dart (2 hints)
  • lib/src/Common/Validation/datetime_validators.dart (1 hint)
  • lib/src/Common/Validation/num_validators.dart (4 hints)
  • lib/src/Common/Validation/other_validators.dart (Run dartfmt to format lib/src/Common/Validation/other_validators.dart.)
  • lib/src/Common/Validation/string_validators.dart (Run dartfmt to format lib/src/Common/Validation/string_validators.dart.)
  • lib/src/Common/Validation/validator.dart (Run dartfmt to format lib/src/Common/Validation/validator.dart.)
  • lib/src/Server/Exceptions.dart (Run dartfmt to format lib/src/Server/Exceptions.dart.)
  • lib/src/Server/Middleware/Validation/ValidationException.dart (Run dartfmt to format lib/src/Server/Middleware/Validation/ValidationException.dart.)
  • lib/src/Server/Middleware/Validation/server_validator.dart (Run dartfmt to format lib/src/Server/Middleware/Validation/server_validator.dart.)
  • lib/src/Server/Middleware/middleware.dart (Run dartfmt to format lib/src/Server/Middleware/middleware.dart.)
  • lib/src/Server/Middleware/middleware_channel_part.dart (1 hint)
  • lib/src/Server/Middleware/middleware_error.dart (Run dartfmt to format lib/src/Server/Middleware/middleware_error.dart.)
  • lib/src/Server/Middleware/middleware_impl.dart (1 hint)
  • lib/src/Server/Routing/ExecuteCode.dart (Run dartfmt to format lib/src/Server/Routing/ExecuteCode.dart.)
  • lib/src/Server/Routing/LoadFile.dart (1 hint)
  • lib/src/Server/Routing/Route.dart (2 hints)
  • lib/src/Server/Routing/RoutingExceptions.dart (Run dartfmt to format lib/src/Server/Routing/RoutingExceptions.dart.)
  • lib/src/Server/Server.dart (3 hints)
  • lib/src/Server/req_res_context.dart (Run dartfmt to format lib/src/Server/req_res_context.dart.)
  • lib/src/Server/req_res_context_impl.dart (Run dartfmt to format lib/src/Server/req_res_context_impl.dart.)

Package is too old.

The package was released more than two years ago.

Use constrained dependencies.

The pubspec.yaml contains 2 dependencies without version constraints. Specify version ranges for the following dependencies: http_server, path.

Add SDK constraint in pubspec.yaml.

For information about setting SDK constraint, please see https://www.dartlang.org/tools/pub/pubspec#sdk-constraints.

Package is pre-release.

Pre-release versions should be used with caution, their API may change in breaking ways.

Maintain an example.

None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use bulls_eye.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
http_server any 0.9.8
path any 1.6.2
Transitive dependencies
mime 0.9.6+2
Dev dependencies
spec_dart any
unittest >=0.9.0 <2.0.0