Skip to content

weyoss/redis-smq-rest-api

Repository files navigation

RedisSMQ

A RESTful API for RedisSMQ

Tests Code quality Coverage Status NPM version

RedisSMQ REST API

RedisSMQ REST API offers an HTTP interface which allows any web capable application to interact with the RedisSMQ message queue using a RESTful API.

Currently, RedisSMQ REST API is distributed as an RC release and is still in active development.

To start using the REST API make sure that you are using the latest RedisSMQ V8 RC release.

Features

  • A clean and simple implementation as always :).
  • Strict Request/Response validation based on JSON Schema.
  • Native OpenAPI v3 support and Swagger for developers.
  • Rigorously tested codebase with code coverage no less than 90%.
  • Both ESM & CJS modules are supported.

Installation

npm i redis-smq-rest-api@rc --save

Configuration

The REST API configuration extends RedisSMQ Configuration while adding the API server configuration.

export type THttpApiConfig = {
  port?: number;
  host?: string;
  basePath?: string;
};

export interface IRedisSMQHttpApiConfig extends IRedisSMQConfig {
  apiServer?: THttpApiConfig;
}

Usage

import { RedisSmqRestApi } from 'redis-smq-rest-api';

const config: IRedisSMQHttpApiConfig = {
    redis: {
        client: ERedisConfigClient.IOREDIS,
        options: {
            host: '127.0.0.1',
            port: 6379,
        },
    },
    apiServer: {
        host: '127.0.0.1',
        port: 7210
    }
};

const apiServer = new RedisSmqRestApi(config);
apiServer.run();

API Reference

Once your RedisSMQ API server is up and running you may view the API Reference and try it directly from the Swagger UI which is accessible via http://<HOSTAME:PORT>/docs.

OpenAPI Specification

The OpenAPI specification is available at http://<HOSTAME:PORT>/assets/openapi-specs.json