<commit_before>apx-express-socket.io [![Build Status](https://travis-ci.org/snailjs/apx-express-socket.io.png?branch=master)](https://travis-ci.org/snailjs/apx-express-socket.io)
============

Express HTTP Server, and Socket.IO translator for APX API server

## Usage

Simply add the initializer to the Apx config.

```
$ npm install apx apx-express-socket.io
```

```js
var apx = require('apx')
apx.setup({
  translators: ['apx-express-socket.io'],
  express: {port: 3000}
})
apx.start()
```

## Configuration

### Express

### Host
* Variable `express.host`
* Require **no**
* Default `null`

Host for express to listen on will default to the express default otherwise

#### Port
* Variable `express.port`
* Required **no**
* Default `3000`

Port to listen on otherwise will default to 3000

### Logger
* Variable `express.logger`
* Require **no**
* Default `null`

Enable or disable the express connection logger explicitly. By default it will
be used during development and disabled when `NODE_ENV` is set to `production`

#### Routes
* Variable `express.routes`
* Required **no**

Array of routes that should be accepted.

```js
{
  express: {
    port: 3000,
    routes: [
      {get: {path: '/status', file: 'actions/status.js'}}
      {post: {path: '/page', file: 'actions/page.js', methods: ['list','find','findOne','save','remove']}}
    ]
  }
}
```

### Socket.IO

#### Enabled
* Variable `socket-io.enabled`
* Required **no**
* Default `true`

Enable or disable Socket.IO also listening on the express port.

#### Log Level
* Variable `socket-io.logLevel`
* Require **no**
* Default `3`

The log level passed to socket.io defaults to 3 in development 0 in production.

#### Routes
* Variable `socket-io.routes`
* Required **no**

Array of routes that should be accepted. These would be considered event listeners, eg `page:list`

```js
{
  express: {
    port: 3000
  },
  'socket-io': {
    routes: [
      {status: 'actions/status.js'},
      {page: {file: 'actions/page.js', methods: ['list','find','findOne','save','remove']}}
    ]
  }
}
```<commit_msg>updated docs for apx usage<commit_after>apx-express-socket.io [![Build Status](https://travis-ci.org/snailjs/apx-express-socket.io.png?branch=master)](https://travis-ci.org/snailjs/apx-express-socket.io)
============

Express HTTP Server, and Socket.IO translator for APX API server

## Usage

Simply add the initializer to the Apx config.

```
$ npm install apx apx-express-socket.io
```

```js
var apx = require('apx')
apx.start({
  translators: ['apx-express-socket.io']
})
```

## Configuration

### Express

### Host
* Variable `express.host`
* Require **no**
* Default `null`

Host for express to listen on will default to the express default otherwise

#### Port
* Variable `express.port`
* Required **no**
* Default `3000`

Port to listen on otherwise will default to 3000

### Logger
* Variable `express.logger`
* Require **no**
* Default `null`

Enable or disable the express connection logger explicitly. By default it will
be used during development and disabled when `NODE_ENV` is set to `production`

#### Routes
* Variable `express.routes`
* Required **no**

Array of routes that should be accepted.

```js
{
  express: {
    routes: [
      {get: {path: '/status', file: 'actions/status.js'}}
      {post: {path: '/page', file: 'actions/page.js', methods: ['list','find','findOne','save','remove']}}
    ]
  }
}
```

### Socket.IO

#### Enabled
* Variable `socket-io.enabled`
* Required **no**
* Default `true`

Enable or disable Socket.IO also listening on the express port.

#### Log Level
* Variable `socket-io.logLevel`
* Require **no**
* Default `3`

The log level passed to socket.io defaults to 3 in development 0 in production.

#### Routes
* Variable `socket-io.routes`
* Required **no**

Array of routes that should be accepted. These would be considered event listeners, eg `page:list`

```js
{
  'socket-io': {
    routes: [
      {status: 'actions/status.js'},
      {page: {file: 'actions/page.js', methods: ['list','find','findOne','save','remove']}}
    ]
  }
}
```
{'fraction_non_alphanumeric': 0.16842881731005654, 'fraction_numerical': 0.008359970494221785, 'mean_word_length': 4.104140526976161, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1905143', 'n_tokens_mistral': 1373, 'n_tokens_neox': 1309, 'n_words': 411}