sails-hook-gravatar

0.1.0 • Public • Published

sails gravatar hook

why

I needed a simple plug-in to experiment around sailsjs extensions.

what

It decorates a given model with a new method "gravatar" that outputs a gravatar url.

By default, it will decorate User and search for an email property to perform the md5 hash. If you want to override those, you can create a config.gravatar object, having the following structure :

{
    model: 'ModelName',
    field: 'fieldName'
}

It will also create a custom route get /<ModelName>/:id/gravatar for your api, and responds a formatted message:

{
    url: 'GravatarUrl'
}

You can disable this by adding route: false to the configuration object.

how

npm install sails-hook-gravatar

that's it.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.0
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.0
    0

Package Sidebar

Install

npm i sails-hook-gravatar

Weekly Downloads

0

Version

0.1.0

License

MIT

Last publish

Collaborators

  • y_nk