You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

ah-openrecord-plugin

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ah-openrecord-plugin

OpenRecord plugin for actionhero

2.13.6
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

Actionhero OpenRecord initializer

  • be sure to enable the plugin within actionhero (config/api.js)
  • you will need to add the ah-openrecord-plugin package (npm install ah-openrecord-plugin --save) to your package.json

configure your database connection via config/database.js

global Resource() function

The global Resource() function is a macro for creating actionhero actions. The following example creates 5 actions which will use the User model:

  • users:create
  • users:destroy
  • users:update
  • users:get
  • users:list
module.exports = Resource('User');

If you just need e.g. list do the following:

module.exports = Resource('User', {
	actions: ['list']
});

Optional Options

  • action: The base resource name. e.g. user. By default it'll take the filename (without .js)
  • actions: Array of available actions. e.g. ['list', 'get']
  • scope: Array of OpenRecord scopes which should be called
  • prefix: Action name prefix. prefix: 'admin' will create action admin:user:list
  • requireAuth: Boolean. Is authentication required or not (will behandled by identity plugin)
  • requireRole: String. What role do you need to call that actions (will behandled by identity plugin)
  • afterFind: Function. Like an actionhero action - but will be called after find (api, connection, next)
  • afterGet: Function. Like an actionhero action - but will be called after get (api, connection, next)
  • afterUpdate: Function. Like an actionhero action - but will be called after update (api, connection, next)
  • afterCreate: Function. Like an actionhero action - but will be called after create (api, connection, next)
  • afterDestroy: Function. Like an actionhero action - but will be called after destroy (api, connection, next)
  • custom: Array of custom actionhero actions

Keywords

orm

FAQs

Package last updated on 31 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts