bliss 0.1.2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • --

Bliss #

An easy to learn server side framework for Dart.

Purpose #

The purpose of this package is to be used internally at Indecks, but to also be extendable enough to be used in other projects. It can be used for serving static files and/or handling dynamic requests.

Usage #

A simple use case example:

import 'package:bliss/bliss.dart';

main() {
  
  Server server = new Server()
    ..setStaticHandler(
        'web',
        defaults: ['index.html'])

    ..addHandler('GET', '/api/user/:id', (Map data) {

      Map user = {};
      // query database with `data['id']` and assign it to `user`
      return user;

    })

    ..addHandler('POST', '/api/post', (Map postData, HttpRequest request) async {

      // store `postData` into database
      // add cookie to `request`

    })

    ..start();
}

Planned Features #

  • SSL support
  • Define specific codec for request payloads
  • WebSocket handlers

Features and bugs #

Please file feature requests and bugs at the issue tracker.

Contribute #

Feel free to fork and make a pull request. Please stick to the Dart Style Guide

Changelog #

0.0.1 #

  • Initial version, created by Stagehand

0.1.0 #

  • Create new Server object to set static handler and add dynamic handlers.

0.1.2 #

  • Fixed Issue #1, can now leave Server constructor's parameters empty.

example/bliss_example.dart

library bliss.example;

import 'dart:async';

import 'package:bliss/bliss.dart';

void main() {
  
  Server server = new Server()
    ..setStaticHandler('web')
    ..addHandler('get', '/api/:example', returnData)
    ..start(); // Run the server to start listening for requests

}

// You can use asynchronous function for the handler task's and it will await 
// for the response.
Future returnData(data) async => data;

Use this package as a library

1. Depend on it

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


dependencies:
  bliss: ^0.1.2

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:bliss/bliss.dart';
  
Version Uploaded Documentation Archive
0.3.1 Dec 14, 2017 Go to the documentation of bliss 0.3.1 Download bliss 0.3.1 archive
0.3.0 Nov 13, 2016 Go to the documentation of bliss 0.3.0 Download bliss 0.3.0 archive
0.2.1 Jul 16, 2016 Go to the documentation of bliss 0.2.1 Download bliss 0.2.1 archive
0.2.0 May 28, 2016 Go to the documentation of bliss 0.2.0 Download bliss 0.2.0 archive
0.1.5 Feb 27, 2016 Go to the documentation of bliss 0.1.5 Download bliss 0.1.5 archive
0.1.2 Jan 26, 2016 Go to the documentation of bliss 0.1.2 Download bliss 0.1.2 archive
0.1.1 Jan 23, 2016 Go to the documentation of bliss 0.1.1 Download bliss 0.1.1 archive
0.1.0 Jan 23, 2016 Go to the documentation of bliss 0.1.0 Download bliss 0.1.0 archive
Awaiting analysis to complete.