Crimsonhttp - http server for Dart

Crimson Dart Http middleware

Project maintained by chrisbu Hosted on GitHub Pages — Theme by mattgraham

CrimsonHttp server for Dart

Currently uses the chat sample http server, but will be ported to the dart:io http server once that is released

Loosely inspired upon sencha/connect for node.js

Makes use of log4dart, found here: (It expects to find log4dart in ../log4dart (ie, at the same level as crimson, not within the crimson folder structure).

Usage: See test/crimsonTest.dart for example, but it goes something like this...

main() {
  CrimsonHttpServer server = new CrimsonHttpServer();

  CrimsonModule sampleModule = new CrimsonModule(server);
                .addEndpoint(new Favicon("./favicon.ico"))               //match the favicon request
                .addFilter(new CookieSession())                          //adds session support
                .addEndpoint(new Route("/hello","GET",(req,res,data) {   //execute arbitary code that matches a route
                .addEndpoint(new StaticFile("./public"));                //serve static files

  server.modules["*"] = sampleModule;  //this is the default module.

  server.listen("", 8082);