nice-commander
Nice Commander
Last updated 12 hours ago by mohsen .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install nice-commander 
SYNC missed versions from official npm registry.

Nice Commander

CI

NiceCommander runs scheduled and one-off tasks in your Node.js server with a nice UI

Quick Start

Requirements

  • Redis Server for distributed locking
  • MySQL Server for its task and task-run database
  • Amazon CloudWatch Logs Access to store logs

Define your tasks

Create a directory dedicated to your tasks. Create one or many files that export task definitions. Task definitions must conform to the TaskDefinition TypeScript interface.

// tasks/simple.js
/**
 * Using JSDoc you can type the exported task
 * @type {import("nice-commander").TaskDefinition}
 */
module.exports = {
  name: "my-task",
  async run() {
    console.log("my-task is running");
  },
  timeoutAfter: "2 seconds",
};

If you are using TypeScript you can import the TaskDefinition interface and type your task default export with it.

Add NiceCommander to your Express server

NiceCommander is an Express middleware. Create an instance of NiceCommander and pass required configurations for MySQL and Redis as well as the path you want the UI to be accessible from under mountPath.

import express from "express";
import path from "path";
import AWS from "aws-sdk";
import { createMiddleware } from "nice-commander";

const app = express();

const mountPath = "/nice-commander";
const { middleware } = createMiddleware({
  taskDefinitionsDirectory: path.resolve(__dirname, "tasks"),
  mountPath,
  redisConnectionOptions: {
    /* Redis Config */
  },
  sqlConnectionOptions: {
    /* DB Config */
  },
  awsRegion: "us-east-2",
  awsCredentials: new AWS.Credentials({
    accessKeyId: "xxx",
    secretAccessKey: "xxx",
  }),
});
app.use(mountPath, middleware);

app.listen(3000);

Current Tags

  • 1.1.7                                ...           latest (12 hours ago)

39 Versions

  • 1.1.7                                ...           12 hours ago
  • 1.1.6                                ...           17 hours ago
  • 1.1.5                                ...           2 days ago
  • 1.1.4                                ...           2 days ago
  • 1.1.3                                ...           2 days ago
  • 1.1.2                                ...           2 days ago
  • 1.1.1                                ...           2 days ago
  • 1.1.0                                ...           2 days ago
  • 1.0.0                                ...           a month ago
  • 0.0.32                                ...           a month ago
  • 0.0.31                                ...           2 months ago
  • 0.0.30                                ...           2 months ago
  • 0.0.29                                ...           2 months ago
  • 0.0.28                                ...           2 months ago
  • 0.0.27                                ...           2 months ago
  • 0.0.26                                ...           2 months ago
  • 0.0.25                                ...           2 months ago
  • 0.0.24                                ...           2 months ago
  • 0.0.23                                ...           2 months ago
  • 0.0.22                                ...           2 months ago
  • 0.0.21                                ...           2 months ago
  • 0.0.20                                ...           2 months ago
  • 0.0.19                                ...           2 months ago
  • 0.0.18                                ...           2 months ago
  • 0.0.17                                ...           2 months ago
  • 0.0.16                                ...           2 months ago
  • 0.0.15                                ...           2 months ago
  • 0.0.14                                ...           2 months ago
  • 0.0.13                                ...           2 months ago
  • 0.0.12                                ...           3 months ago
  • 0.0.11                                ...           3 months ago
  • 0.0.10                                ...           3 months ago
  • 0.0.8                                ...           6 months ago
  • 0.0.7                                ...           6 months ago
  • 0.0.6                                ...           6 months ago
  • 0.0.5                                ...           6 months ago
  • 0.0.4                                ...           6 months ago
  • 0.0.2                                ...           6 months ago
  • 0.0.1                                ...           6 months ago
Maintainers (1)
Downloads
Today 54
This Week 110
This Month 110
Last Day 45
Last Week 0
Last Month 10
Dependencies (36)
Dev Dependencies (29)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |