# yakjs

> YAKjs - a local server to stub WebSocket backends.

Latest version **3.6.1** (published 2020-09-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install yakjs
pnpm add yakjs
yarn add yakjs
bun add yakjs
```

Provides the command `yakjs`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.6.1 |
| Published | 2020-09-01 |
| First published | 2015-09-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10.0.0 |
| Dependencies | 14 |
| Unpacked size | 155.8 KB |
| Known vulnerabilities | 0 (+4 in 2 direct dependencies) |
| Install scripts | no |
| Author | Christian Schuller |
| Maintainers | cschuller |
| Keywords | YAK, WebSocket, server, prototyping, simulation, stub, testing |

## Links

- npm: https://www.npmjs.com/package/yakjs
- Repository: https://github.com/cschuller/yakjs
- Homepage: https://github.com/cschuller/yakjs#readme
- Issues: https://github.com/cschuller/yakjs/issues
- npm.io page: https://npm.io/package/yakjs

## Dependencies (14)

- [ws](https://npm.io/package/ws.md) ~7.1.2
- [cors](https://npm.io/package/cors.md) ^2.8.5
- [log4js](https://npm.io/package/log4js.md) ^5.0.0
- [moment](https://npm.io/package/moment.md) ^2.2.24
- [semver](https://npm.io/package/semver.md) ^6.3.0
- [express](https://npm.io/package/express.md) ^4.17.1
- [fs-extra](https://npm.io/package/fs-extra.md) ^8.1.0
- [minimist](https://npm.io/package/minimist.md) ^1.2.0
- [mime-types](https://npm.io/package/mime-types.md) ^2.1.24
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.0
- [body-parser](https://npm.io/package/body-parser.md) ^1.19.0
- [util.promisify](https://npm.io/package/util.promisify.md) ^1.0.0
- [http-status-codes](https://npm.io/package/http-status-codes.md) ^1.3.2
- [@yakjs/yakjs-client](https://npm.io/package/@yakjs/yakjs-client.md) ^1.0.2

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 3.6.1 (latest) — 2020-09-01
- 3.6.0 — 2019-09-28
- 3.5.0 — 2019-08-23
- 3.4.2 — 2019-05-25
- 3.4.1 — 2019-02-06
- 3.4.0 — 2019-01-31
- 3.3.1 — 2019-01-31
- 3.3.0 — 2018-11-11
- 3.2.0 — 2018-11-10
- 3.1.2 — 2018-07-30
- 3.1.1 — 2018-04-04
- 3.1.0 — 2018-04-01
- 3.1.0-beta.1 — 2018-03-12
- 3.0.4 — 2017-08-11
- 3.0.3 — 2017-07-27
- … 26 more at https://npm.io/package/yakjs/versions

## README

# ![YAKjs logo](http://www.yakjs.com/asset/yakjs-logo-dark.svg)
[![GitHub version](https://img.shields.io/github/tag/cschuller/yak-js.svg?style=flat-square)](https://github.com/cschuller/yakjs)
[![npm](https://img.shields.io/npm/v/yakjs.svg?style=flat-square)](https://www.npmjs.com/package/yakjs)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://raw.githubusercontent.com/cschuller/yakjs/master/LICENSE)

A local server to stub complex WebSocket back-ends.

## Documentation

Visit [yakjs.com](http://www.yakjs.com/) for full documentation.

## Getting started

YAKjs requires [nodejs](https://nodejs.org/).

### 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**](http://localhost:8790)

## Versions

### 3.5.0

#### InstanceStarted event

Adds a new InstanceStarted event with access to the [express app](https://expressjs.com/en/starter/hello-world.html).
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.

```javascript
/**
 * @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.

---
_Source: https://npm.io/package/yakjs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
