npm.io
3.6.1 • Published 6 years agoCLI

yakjs

Licence
MIT
Version
3.6.1
Deps
14
Size
156 kB
Vulns
4
Weekly
0

YAKjs logo

GitHub version npm GitHub license

A local server to stub complex WebSocket back-ends.

Documentation

Visit yakjs.com for full documentation.

Getting started

YAKjs requires nodejs.

Install via npm
npm install yakjs -g
Start YAKjs
> yakjs

This will start YAKjs using default port 8790.

Open the YAKjs User Interface

Open the YAKjs user interface at http://localhost:8790

Versions

3.5.0
InstanceStarted event

Adds a new InstanceStarted event with access to the express app. Register your routes or own middleware for an instance.

When running an instance on port 9020 with the example plugin, then a GET request can be sent to http://localhost:9020 Keep in mind that an instance can use multiple plugins, use your routes accordingly to avoid conflicts.

/**
 * @constructor
 * @struct
 * @see {!PluginWorker}
 */
function HelloWorldPlugin() {
    /**
     * @param {!InstanceStartedEvent} event
     */
    this.onInstanceStarted = event => {
        event.app.get('/', function(req, res) {
            res.send('Hello world!');
        });
    };
}

/**
 * @type {!Plugin}
 */
module.exports = {
    name: 'hello-world',
    description: 'Say hello to the world.',
    createWorker: () => new HelloWorldPlugin()
};
Removes the WSS/HTTPS experiment

Removes the YAKjs server configuration to enable WSS/HTTPS with a (unsecure) test certificate.

Keywords