halifier
A helper toolset for building HAL API with express
Features:
- converts JS objects and arrays of objects to HAL responses
- adds extra conventional field
_listMeta
when returning arrays of objects - provides simple implementation for a controller providing HAL interface to a collection
This is a basis for further concrete implementations such as:
- halifier-sequelize
- halifier-mongoose
Usage examples
pure AbstractItemHalifier
const AbstractItemHalifier = const data = pass: 'ZK872343' name: 'John' eyeColor: 'blue' weight: 70 pass: 'ANK34323' name: 'Marry' eyeColor: 'brown' weight: 65 pass: 'LP109929' name: 'T1000' eyeColor: 'red' weight: 128 const app = const peopleHalifier = app idFieldName: 'pass' baseUrl: '/humans' name: 'human' listMeta: limit: 2 // number of returned objects in one response app app app