UNPKG

1.39 kBJavaScriptView Raw
1/*
2Kettle App support
3
4Copyright 2012-2013 OCAD University
5
6Licensed under the New BSD license. You may not use this file except in
7compliance with this License.
8
9You may obtain a copy of the License at
10https://github.com/fluid-project/kettle/blob/master/LICENSE.txt
11*/
12
13"use strict";
14
15var fluid = require("infusion");
16
17/** A Kettle "app" is an "independently mountable application unit". An app aggregates together
18 * a set of "handlers" which are mounted within it to handle one or more request types
19 * at certain URL paths. Kettle includes support for handlers of HTTP endpoints and
20 * experimental support for WebSockets endpoints. One or more Kettle apps may be
21 * aggregated together into a Kettle "servers" of type <code>kettle.server</code>. A Kettle
22 * server corresponds directly to a node.js HTTP server (connect/express server) in terms
23 * of being "a thing listening on a TCP port". Configuration supplied to the
24 * options of all apps at their options path "handlers" is aggregated together to their enclosing
25 * server.
26 */
27
28fluid.defaults("kettle.app", {
29 gradeNames: ["fluid.component"],
30 requestHandlers: {},
31 listeners: {
32 "onCreate.register": {
33 listener: "kettle.server.registerApp",
34 args: ["{kettle.server}", "{that}"]
35 }
36 },
37 components: {
38 requests: {
39 type: "kettle.requests"
40 }
41 }
42});