2.0.0 • Published 6 years ago

netiam-contrib-rest v2.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

netiam-contrib-rest

Build Status Dependencies npm version

A REST plugin for netiam

Get it

npm i -S netiam netiam-contrib-rest

Example

netiam({plugins})
  .rest({model: User})
  .json()

Compound Documents

To reduce the number of HTTP requests, you can embed related documents within the response object. You can do so, by utilizing the include parameter.

GET /articles?include=comments

Youc an also include more than one document at the same time.

GET /articles?include=comments,links

There is also support for deeply nested documents and documents on the same branch.

GET /articles?include=comments.author.profile,comments.author.image

Transactions

This plugin does support transactions via sequelize cls namespaces. However, it does not enforce transactions as you might use a database engine w/o any support for transactions.

How to

// test/utils/db.js
import Sequelize from 'sequelize'
import cls from 'continuation-local-storage'
import uuid from 'uuid'

const namespace = cls.createNamespace(uuid.v4())
Sequelize.cls = namespace

export const db = new Sequelize('database', 'username', 'password', {
  …
})

License

MIT License

2.0.0

6 years ago

1.13.0

8 years ago

1.12.6

8 years ago

1.12.5

8 years ago

1.12.4

8 years ago

1.12.3

8 years ago

1.12.2

8 years ago

1.12.1

8 years ago

1.12.0

8 years ago

1.11.0

8 years ago

1.10.0

8 years ago

1.9.6

8 years ago

1.9.5

8 years ago

1.9.4

8 years ago

1.9.3

8 years ago

1.9.2

8 years ago

1.9.1

8 years ago

1.9.0

8 years ago

1.8.3

8 years ago

1.8.2

8 years ago

1.8.1

8 years ago

1.8.0

8 years ago

1.7.3

8 years ago

1.7.2

8 years ago

1.7.1

8 years ago

1.7.0

8 years ago

1.6.3

8 years ago

1.6.2

8 years ago

1.6.1

8 years ago

1.6.0

8 years ago

1.5.0

8 years ago

1.4.0

8 years ago

1.3.0

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago