ravecat-dispatcher

4.0.4 • Public • Published

RaveCat Dispatcher

Install

npm i --save ravecat-dispatcher

or

yarn add ravecat-dispatcher

Use

import { setupDispatcher } from 'ravecat-dispatcher';

setupDispatcher({
	setupConfig: () => {
    return {
      httpPort: 3020,
      httpInnerPort: 3050,
      wsPort: 8000,
      sessionSecret: 'pasteSecretCode',
      redis: {
        host: '127.0.0.1',
        port: 6379
      },
    }
  },
	setupDB: (Config) => {
    return { /* Bookshelf */ };
  },
	setupModels: (DB) => {
    // Exapmle: UserModel
    //const UserModel = DB.Bookshelf.Model.extend({ tableName: 'users' });

    // Return Models
    return { /* UserModel */ };
  },
	authServices: [
    // (passport, httpServer, App) => {}
  ],
	clientMethods: {
    test1: {
      access: (args, connectionData, App) => {
        return true; // if true -> run action
      },
      action: (args, connectionData, App) => {
        return 'test done';
      }
    },
    test2: (args, connectionData, App) => {
      return 'test 3 done';
    }
  },
	services: {
    Test: {
      test: (args, App) => {
        return 'service test done';
      }
    }
  },
	// Current Instance Ready
	instanceReady: (instanceId, App) => {
	
	},
	// Some Instance Down
	instanceDown: (instanceId, App) => {

	},
	// App Ready (instancesCount: 0 -> 1)
	appReady: (App) => {
		App.Test('test').then(console.log);
	}
});

Readme

Keywords

none

Package Sidebar

Install

npm i ravecat-dispatcher

Weekly Downloads

1

Version

4.0.4

License

MIT

Last publish

Collaborators

  • sygeman