Skip to content

Commit

Permalink
add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
stongo committed Aug 27, 2015
1 parent cde6c0f commit 1b1d620
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Nsquihsy Message

Provides a standardized message model to be used in NSQ

Module returns an extendable factory

## Schema

The following model properties will be created for each model. The factory containers a `schema` property containing the [Joi](https://github.com/hapijs/joi) schema.

```
{
id: Joi.string().default(uuid.v1, 'unique id'),
source: Joi.string().required(),
timestamp: Joi.date().format('x').default(Date.now, 'timestamp'),
reference: Joi.string().default(''),
payload: Joi.any().optional()```
}
```

## Creating a message

```
var Message = require('nsquishy-message');
var message = new Message({
source: 'build-worker',
referemce: '9d107c4e-0414-45a1-9cec-99930d980de2',
payload: 'build successful'
});
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nsquishy-message",
"version": "1.0.0",
"version": "1.0.1",
"licenses": [
{
"type": "MIT"
Expand Down

0 comments on commit 1b1d620

Please sign in to comment.