Giter Site home page Giter Site logo

zwhitchcox / crimsonhttp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chrisbu/crimsonhttp

0.0 3.0 0.0 783 KB

Dart HTTP webserver, providing server side session and routing and static file serving.

Home Page: chrisbu.github.com/CrimsonHttp

License: MIT License

Dart 41.59% HTML 58.41%

crimsonhttp's Introduction

CrimsonHttp server for Dart

Introduction

Loosely inspired upon sencha/connect for node.js

Status: Alpha

This code is alpha and might not be safe for production servers.

Example

#import("dart:io");
#import("dart:utf");
#import('package:crimsonhttp/crimson.dart');

void main() {
  CrimsonHttpServer server = new CrimsonHttpServer();
  
  CrimsonModule sampleModule = new CrimsonModule(server);
  sampleModule.handlers
                    .addEndpoint(new StaticFile("./test/public/"))
                    .addEndpoint(new StaticFile("./test/sandbox/"));
  
  server.modules["*"] = sampleModule;
  server.listen("0.0.0.0", 8082);
}

Getting Started

Create a Dart project and add a pubspec.yaml file to it

dependencies:
  crimsonhttp:
    git: https://github.com/chrisbu/CrimsonHttp.git

and run pub install to install crimson (including its dependencies). Now add import

#import('package:crimsonhttp/crimson.dart');

#TODO

  • Lots, especially tidy up CookieSession and StaticFile, and add Route.
  • Please treat all of this as pre-alpha.
  • It's not secure in the slightest, and the StaticFile handler alone will probably allow users to browse your pc!

#Filters

  • CookieSession: sets a sessioncookie - just ported at the moment and not yet tested. Treat as pre-alpha.

#Endpoints

  • Favicon: Serves a favicon from either the default ./favicon.ico or ./public/favicon.ico, or some specified location.
  • StaticFile: serves static files from the path provided in the constructor. Simply appends the request.uri onto whatever path you provide in, and tries to load it. Very insecure.
  • Route: executes a dart method in resposne to matching a path + method, or a matching function

crimsonhttp's People

Contributors

adam-singer avatar chrisbu avatar geekrumper avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.