<commit_before># Lugate
Lugate is a lua module for building JSON-RPC 2.0 Gateway APIs just inside of your Nginx configuration file.

[![Build Status](https://travis-ci.org/zinovyev/lugate.svg?branch=master)](https://travis-ci.org/zinovyev/lugate)

## About
Lugate is a helper set which is meant to be used together with [ngx\_http\_lua\_module](https://github.com/openresty/lua-nginx-module) module.
It provides you several special methods for validating a JSON-RPC 2.0 request, looping a batch call and building a
valid response.

## Synopsis
```lua
    server {
        listen       80;
        server_name  gateway.lugate.loc;

        access_log  /var/log/nginx/gateway_access.log;
        error_log  /var/log/nginx/gateway_error.log;

        location / {
              # MIME type determined by default_type:
              default_type 'application/json';

              content_by_lua_block {
                -- POST request
                if 'POST' == ngx.req.get_method() then<commit_msg>README.md updated<commit_after># Lugate
Lugate is a lua module for building JSON-RPC 2.0 Gateway APIs just inside of your Nginx configuration file.

[![Build Status](https://travis-ci.org/zinovyev/lugate.svg?branch=master)](https://travis-ci.org/zinovyev/lugate)

## About
Lugate is a helper set which is meant to be used together with [ngx\_http\_lua\_module](https://github.com/openresty/lua-nginx-module) module.
It provides you several special methods for validating a JSON-RPC 2.0 request, looping a batch call and building a
valid response.

## Install
Lugate can be installed via the luarocks package manager. Just run:
```bash
luarocks install lugate
```

## Synopsis
```lua
    server {
        listen       80;
        server_name  gateway.lugate.loc;

        access_log  /var/log/nginx/gateway_access.log;
        error_log  /var/log/nginx/gateway_error.log;

        location / {
              # MIME type determined by default_type:
              default_type 'application/json';

              content_by_lua_block {
                -- POST request
                if 'POST' == ngx.req.get_method() then
{'fraction_non_alphanumeric': 0.09593572778827977, 'fraction_numerical': 0.005671077504725898, 'mean_word_length': 2.7075306479859895, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, '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': '4341223', 'n_tokens_mistral': 676, 'n_tokens_neox': 640, 'n_words': 186}