npm.io
1.0.1 • Published 8 years ago

dambreaker

Licence
MIT
Version
1.0.1
Deps
10
Size
1.2 MB
Vulns
0
Weekly
0
Stars
2
DeprecatedThis package is deprecated

DamBreaker

Streamify your web server.

stream.write({ word: "Dam" });
stream.end({ word: "Less" });

DamBreaker is the first NodeJS web server dedicated to streamify all responses.

npm install dambreaker --save

NPM Build Status Coverage Status NPM Download Dependencies Status

Features

 * Structured your project using services.  * Dependency Injection to override default behavior.

Service.js

class Service {	
};

text(context, stream, headers) {
 stream.write("Hello");
 stream.end("world")
};

json(context, stream, headers) {
  stream.write({ name: "peter" });
  stream.end({ name: "folk" });
};

exports = module.exports = Service;

Dependency Injection

Inject your service and define a new http route.

Override core services to custom DamBreaker.

{
  "services": [
    { "name": "service", "location": "./service"}
  ]
  "http-routes": [   
  ]
}

DamBreaker Configuration

{
    "services": "./services.json",
    "http": {
        "port": 3000
    }
}

Enjoy

Create a server.js



const DamBreaker = require("dambreaker");
const dambreaker = new Damless();
await dambreaker.start();

Run server on http://localhost:3000

Use other DamBreaker services to develop as fast as a rocket

You want to see some examples

To run our examples, clone the Qwebs repo and install the dependencies.

$ git clone https://github.com/BenoitClaveau/dambreaker --depth 1
$ cd dambreaker
$ npm install
$ cd exemples/helloworld
$ node server.js

Test

To run our tests, clone the Qwebs repo and install the dependencies.

$ git clone https://github.com/BenoitClaveau/dambreaker --depth 1
$ cd dambreaker
$ npm install
$ cd tests
$ node.exe "../node_modules/mocha/bin/mocha" .

Keywords