https://github.com/andreialecu/dpd-codemodule
This custom resource type allows you to write code that can be required by other resources.
https://github.com/andreialecu/dpd-codemodule
deployd
Last synced: 29 days ago
JSON representation
This custom resource type allows you to write code that can be required by other resources.
- Host: GitHub
- URL: https://github.com/andreialecu/dpd-codemodule
- Owner: andreialecu
- License: mit
- Created: 2017-11-02T22:26:40.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-03T11:58:39.000Z (over 8 years ago)
- Last Synced: 2025-03-06T16:50:48.625Z (over 1 year ago)
- Topics: deployd
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Code Resource for deployd
[](https://www.npmjs.org/package/dpd-codemodule)
This is a custom [deployd](https://www.npmjs.org/package/deployd) resource type allows you to write code that can be `require`d by other resources.
### Installation
In your app's root directory, type `npm install dpd-codemodule --save` into the command line or [download the source](https://github.com/deployd/dpd-codemodule). This should create a `dpd-codemodule` directory in your app's `node_modules` directory.
See [Installing Modules](http://docs.deployd.com/docs/using-modules/installing-modules.md) for details.
### Usage
You can write your reusable code inside the `Index` event. Follow `nodejs` module conventions by using `exports.somename = ...;`. See nodejs [modules](https://nodejs.org/api/modules.html) documentation for more details.
Later on in your event code, you can use:
`var myCodeModule = requireModule('coderesourcename');` and you will have access to the code shared by the module.
This resource explicitly adds the `requireModule(name)` global function which acts as a helper function for finding the proper path of the module.
Alternatively, you can use something like `require('../../resources/coderesourcename')`.