bulls_eye 0.3.0-alpha

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 24

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

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages 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

Analysis

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

  • Dart: 2.0.0-dev.54.0
  • pana: 0.11.1

Scores

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

Platforms

Detected platforms: Flutter, other

Platform components identified in package: io.

Suggestions

  • Use constrained dependencies.

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

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 9 errors 52 hints.

    Strong-mode analysis of lib/src/Common/UrlDefenition/url_matcher.dart failed with the following error:

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

    Strong-mode analysis of lib/src/Server/Middleware/Validation/ValidationEngine.dart failed with the following error:

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

    Similar analysis of the following files failed:

    • lib/src/Server/input_data.dart (error)
    • lib/src/Server/read_only_map.dart (error)
    • lib/common.dart (hint)
    • lib/src/Common/Extensions/version_path_part.dart (hint)
    • lib/src/Common/UrlDefenition/path_parts.dart (hint)
    • lib/src/Common/UrlDefenition/query_parts.dart (hint)
    • lib/src/Common/UrlDefenition/url.dart (hint)
    • lib/src/Common/UrlDefenition/url_def_config.dart (hint)
    • lib/src/Common/Validation/bool_validators.dart (hint)
    • lib/src/Common/Validation/datetime_validators.dart (hint)
    • lib/src/Common/Validation/num_validators.dart (hint)
    • lib/src/Common/Validation/other_validators.dart (hint)
    • lib/src/Common/Validation/string_validators.dart (hint)
    • lib/src/Common/Validation/validator.dart (hint)
    • lib/src/Server/Exceptions.dart (hint)
    • lib/src/Server/Middleware/Validation/ValidationException.dart (hint)
    • lib/src/Server/Middleware/Validation/server_validator.dart (hint)
    • lib/src/Server/Middleware/middleware.dart (hint)
    • lib/src/Server/Middleware/middleware_channel_part.dart (hint)
    • lib/src/Server/Middleware/middleware_error.dart (hint)
    • lib/src/Server/Middleware/middleware_impl.dart (hint)
    • lib/src/Server/Routing/ExecuteCode.dart (hint)
    • lib/src/Server/Routing/LoadFile.dart (hint)
    • lib/src/Server/Routing/Route.dart (hint)
    • lib/src/Server/Routing/RoutingExceptions.dart (hint)
    • lib/src/Server/Server.dart (hint)
    • lib/src/Server/req_res_context.dart (hint)
    • lib/src/Server/req_res_context_impl.dart (hint)
  • Package is pre-release.

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

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • 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.7
path any 1.5.1
Transitive dependencies
mime 0.9.6+1
Dev dependencies
spec_dart any
unittest >=0.9.0 <2.0.0