Getting Started
This is basic and shortest step-by-step guide how to start using @imqueue
.
For more detailed guide, take a look at Tutorial.
Full API technical documentation is available here.
Table Of Contents
Before We Start
Make sure you have all required software pre-installed in your system. Here is what we need:
- NodeJS. We recommend to install it via NVM
- Redis version 3.2 or above recommended
- Git command-line tool
1. Installing
First, it is recommended to install IMQ command line tool globally as:
> npm i -g @imqueue/cli
During the first installation it will prompt you to enter some initial
configuration information. You may proceed filling it up or skip it by
pressing <Ctrl>+<C>
and configure it later (or never).
2. Configuring
@imqueue/cli
tool does not require mandatory configuration. By the way,
if you’re going to work on a big project with a large subset of services,
it may be useful to define a global configuration once and simplify most
of the typing commands in your terminal.
If configuration step was skipped during installation or you need to re-define existing config, use the following command:
> imq config init
3. Enable Completions
After installation and configuration it is recommended to turn on completions
support for imq
command in your terminal. Simply run:
> imq completions on
and follow further instructions. Currently, it supports bash
and zsh
terminals.
4. Usage
IMQ command line tool was created specially to free you up from writing
boilerplate while making @imqueue
based back-end services. There are 2 major
things it can do for you:
- Create services from pre-defined boilerplate templates
- Manage clients code generation
4.1 Creating Service
To create a service from boilerplate, run these commands in your terminal:
> mkdir user-service
> cd user-service
> imq service create
Now open src/UserService.ts
and implement all required methods (functionality)
you need for this service.
4.2 Running Service
Make sure you have Redis server running on default port before launching your service. Running service is easy, just execute:
> npm run dev
4.3 Generating Client
All @imqueue services are self-describable. To generate a client you will need to run service first. After that, run in your terminal:
> mkdir clients
> cd clients
> imq client generate UserService
Now client can be used to call service methods remotely.