/ma-tt

Primary LanguageJavaScript

MoonActive TT

Simple API for scheduling messages to be printed in the future.

Prerequisites

Node version 8 or higher. This project requires Redis 2.8 to be installed and set up. Redis Keyspace Notifications also must be enabled:

redis-cli config get notify-keyspace-events
# 1) "notify-keyspace-events"
# 2) ""
redis-cli config set notify-keyspace-events Ex
# OK

If process.env.NODE_ENV !== 'production', then following environment variables must be filled in:

process.env.MA_SERVER_PORT
process.env.REDIS_HOST,
process.env.REDIS_PORT

Otherwise please add these values int config/dev file

Build

Before starting the service we need to install all npm packages:

npm i

Run

To start service simply run following command:

npm start

It will start API at http://localhost:8080/

API Documentation

To view API documantation open: http://localhost:8080/v1.0/docs After starting service.

Schedule message:

To schedule a message you should sent an http POST request to /echoAtTime, please see API documentation after start, in Models section for detailed info.
Body example:

{
  "message": "Really important message to be printed",
  "datetime": "2018-08-15T08:17:05Z"
}

Built With