flow-server-plugin-starter

0.1.0 • Public • Published

Flow Server Plugin Starter

A minimal starter plugin for the Flow Server Framework.

Features

  • Simple plugin structure
  • Service registration
  • Event listeners
  • Lifecycle methods (init, start, stop)

Installation

npm install flow-server-plugin-starter

Usage

In your Flow Server application

const { createFlow } = require('flow-server-framework');
const createStarterPlugin = require('flow-server-plugin-starter');

// Create Flow instance
const flow = createFlow();

// Create and register the plugin
const starterPlugin = createStarterPlugin({
  // Plugin options here
});

// Register the plugin
flow.registerPlugin('starter', starterPlugin);

// Start the application
flow.start()
  .then(() => {
    console.log('Application started with starter plugin');
    
    // Use the plugin's service
    const greeter = flow.getService('starter.greeter');
    console.log(greeter.greet('Developer')); // Hello, Developer! from StarterPlugin
  })
  .catch(err => {
    console.error('Failed to start application:', err);
  });

Creating Your Own Plugin

To create your own plugin based on this starter:

  1. Clone or copy this repository
  2. Modify the package.json to change the name, version, and description
  3. Update the plugin class in src/index.js:
    • Change the class name
    • Update the plugin name, version, and description
    • Implement your custom services and event listeners
    • Add your plugin-specific functionality

Plugin Structure

A Flow Server plugin should implement the following methods:

  • init(flow): Initialize the plugin with the Flow instance
  • start(): Start the plugin
  • stop(): Stop the plugin

License

MIT

Package Sidebar

Install

npm i flow-server-plugin-starter

Weekly Downloads

2

Version

0.1.0

License

MIT

Unpacked Size

4.68 kB

Total Files

4

Last publish

Collaborators

  • xavdp