redstone 0.3.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 14

Redstone.dart #

Build Status

Redstone.dart is a server-side, metadata driven microframework for Dart.

####How does it work? Redstone.dart allows you to easily publish your functions and classes through a web interface, by just adding some annotations to them.


import 'package:redstone/server.dart' as app;

@app.Route("/")
helloWorld() => "Hello, World!";

main() {
  app.setupConsoleLog();
  app.start();
}

####Want to know more? Check out our wiki! :)

v0.3.1 #

  • Renamed project to Redstone.dart
  • New and improved documentation

v0.3.0 #

  • Added Route.matchSubPaths property (see issue #5)
  • Added ErrorHandler.urlPattern property (check documentation for details)
  • Added request attributes (check documentation for details)
  • Added support for dependency injection (check documentation for details)

v0.2.1 #

  • Added support for basic authentication (thanks Y12STUDIO for the contribution)
    • Added parseAuthorizationHeader() method.
    • Added authenticateBasic() method.

v0.2.0 #

  • BREAKING CHANGES (check documentation for more details):
    • VirtualDirectory is now configured with jailRoot = true and followLinks = false. You can change these flags through start() method.
    • For security and perfomance reasons, the parse of request body is now delayed as much as possible, so interceptors will receive null if they call request.body (although request.bodyType is still filled). If your interceptor need to inspect the request body, you can set Interceptor.parseRequestBody = true.
    • Multipart requests (file uploads) are now refused by default. If your method need to receive multipart requests, you can set Route.allowMultipartRequest = true.
    • All arguments of chain.interrupt() method are now optional.
  • Bug fixes in abort(), redirect() and chain.interrupt() methods. (see issue #3).

v0.1.2 #

  • Fix: bloodless crashes on Dart 1.3.

v0.1.1 #

  • Fix: malformed requests can cause a crash

v0.1.0 #

  • Bug fixes
  • BREAKING CHANGE: chain.next() now receives a callback, instead of returning a Future
  • Added new API for unit tests
  • Updated documentation

v0.0.4 #

  • Fix: chain.interrupt() is not closing the HttpResponse stream

v0.0.3 #

  • Added a grinder task to properly copy sever's files to the build folder
  • Updated documentation with a better approach for building projects

v0.0.2 #

  • Small fix to VirtualDirectory configuration

v0.0.1 #

  • First release

example/example.dart

library test_lib;

import 'package:redstone/server.dart' as app;

@app.Route("/")
helloWorld() => "Hello, World!";

@app.Route("/user/:username")
getUsername(String username) => ">> $username";

@app.Interceptor(r'/user/.+')
doge() {
  app.request.response.write("wow! such user!\n\n");
  app.chain.next(() {
    app.request.response.write("\n\nso smart!");
  });
}

@app.Group("/group")
class Group {

  @app.Route("/json", methods: const[app.POST])
  echoJson(@app.Body(app.JSON) Map json) => json;

  @app.Route("/form", methods: const[app.POST])
  echoFormAsJson(@app.Body(app.FORM) Map form) => form;

}

main() {

  app.setupConsoleLog();
  app.start();
  
}

Use this package as a library

1. Depend on it

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


dependencies:
  redstone: ^0.3.1

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

This package version is not analyzed, because it is more than two years old. Check the latest stable version for its analysis.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://dart.dev/dart-2#migration.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.2.0 <2.0.0