0.1.0 • Published 9 years ago

sails-hook-gravatar v0.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

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.