Server ✎
When you invoke the new Grown()
constructor an instance of Server
is born.
const server = new Grown({
foo: 'bar',
baz: {
buzz: 'bazzinga',
},
});
Received options are accessible only within the connection:
server.mount((ctx, options) => {
console.log(options('foo')); // bar
console.log(options('baz.buzz')); // bazzinga
});
Options can resolve to default values, otherwise they'll throw an error:
// it's fine to have default values
const x = options('some.value', 42);
// but some options should be present!
const y = options('a.required.setting.here');
Module
Props mixin
Methods mixin
Public props static
Public methods static
Private* props static
Private* methods static
Instance methods
on(e, cb)
— Subscribe to eventsoff(e, cb)
— Unsubscribe from eventsonce(e, cb)
— Subscribe (once) to eventsemit(e[, ...])
— Broadcast events to listenersrun(scope)
— Dispatch a request through the middlewareplug(extensions)
— Extends the server with additional functionalitymount(middleware)
— Append middleware to the server instancelisten([connection])
— Starts a new web server connectionclients()
— Returns a list of active users connected through WebSockets