Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

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.

Install

npm i sails-hook-gravatar

DownloadsWeekly Downloads

2

Version

0.1.0

License

MIT

Last publish

Collaborators

  • avatar