Socket
Socket
Sign inDemoInstall

ah-openrecord-plugin

Package Overview
Dependencies
109
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ah-openrecord-plugin

OpenRecord plugin for actionhero


Version published
Weekly downloads
1
decreased by-97.67%
Maintainers
1
Install size
9.39 MB
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 31 Aug 2017

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc