Getting started

This chapter will get us going with YAKjs. First we will install YAKjs. Then, we start it. Finally, a classic chat tutorial demonstrates a full end to end use case (for now without coding).

We’ll be showing off a number of commands using a terminal, and those lines all start with $. You don't need to type in the $s, they are there to indicate the start of each command. We’ll see many tutorials and examples around the web that follow this convention: $ for commands run as our regular user, and # for commands we should be running as an administrator.

Installing YAKjs

The first step to using YAKjs is to install it. YAKjs itself is written in JavaScript and needs Node.js® to run. We recommend to use the latest 6.x LTS version (e.g. 6.10.2). If Node.js® is not installed, download it and run the install program.

You can check if Node.js® is installed correctly with this command. It shall print the installed Node.js® version number.

$ node --version

There are two different options to install YAKjs.

YAKjs can be installed via the Node.js package manager (NPM) that is included in the Node.js® installation.

$ npm install yakjs -g

The -g option tells npm to install the YAKjs package globally on the system. It is also possible to install YAKjs locally into the current working directory.

GitHub release

We recommend to install YAKjs via NPM. As an alternative, YAKjs can be downloaded as a release from it's GitHub releases page. Extract the ZIP file into it's own folder. The yakjs command line tool is not globally available. You can add it to your systems path environment configuration manually, or only start YAKjs directly from the folder.

Starting YAKjs

Now that you have YAKjs installed, we want to start it. Open up a shell, and type this:

$ yakjs

Or run the start-yakjs-server script in the installation folder.

.........................................................................
YAKjs server initialized and running on http port 8790
.........................................................................

See ./log/yakjs.log for errors and warnings.
Use --debug to display all log messages in the console.

Press CTRL + C to stop YAKjs.

You should see that YAKjs is running successfully! Congrats! It fails, when another program is already using the default port 8790.

This ports are used when starting YAKjs the first time with default configuration.

PortProtocolDescription

8790

HTTP

Provides the user interface and the REST API.

9020

WS

A chat WebSocket endpoint

Later when you have configured more WebSocket (WS) instances then more ports are used.

Usage

Continue with the chat server tutorial to get a simple chat server up and running.

Rest API

For full details on the Rest API see the API chapter.