marlinspike
v1.0.0
Published
Superpowers for your Sails.js Hooks
Downloads
702
Maintainers
Readme
marlinspike
Superpowers for your Sails.js Hooks.
This package was last updated in 2015. For the most up-to-date information and tools related to hooks in Sails, visit the official Sails website or ask for help.
Features
- Makes it easy to build and maintain Sails Hooks as separate projects
- Magically extend Sails apps with additional Model, Controllers, Services.
Compatibility
- Sails.js 0.12 and newer
- node.js 0.12 and newer
Install
$ npm install marlinspike --save
Usage
// config/customhook.js
export const customhook = {
/**
* Load hook into sails.hooks.custom
*/
name: 'custom',
/**
* Load hook config into sails.hook.customHook
*/
configKey: 'customHook',
marlinspike: {
/**
* Load controllers from ../api/controllers into the parent app
*/
controllers: true,
/**
* Load models from ../api/models into the parent app
*/
models: true,
/**
* Load services from ../api/services into the parent app
*/
services: true,
/**
* Load config from ../config/customhook.js into the parent app
*/
config: true
}
}
// api/hooks/customhook.js
import Marlinspike from 'marlinspike'
class CustomHook extends Marlinspike {
defaults (overrides) {
// http://sailsjs.org/documentation/concepts/extending-sails/hooks/hook-specification/defaults#?using-defaults-as-a-function
},
configure () {
// this.sails = sails
// http://sailsjs.org/documentation/concepts/extending-sails/hooks/hook-specification/configure
},
initialize (next) {
// http://sailsjs.org/documentation/concepts/extending-sails/hooks/hook-specification/initialize
},
routes () {
return {
// http://sailsjs.org/documentation/concepts/extending-sails/hooks/hook-specification/routes
}
}
}
export default Marlinspike.createSailsHook(CustomHook)
License
MIT