0.21.1 • Published 1 year ago
feathers-yaml v0.21.1
feathers-lowdb-yaml
Deprecated in favor of https://github.com/lwhiteley/feathers-lowdb
A Feathers service adapter for YAML data storage that works on all platforms. Using LowDB v3. Good for cashing, development, debugging and offline-support.
Roadmap
- Basic LowDB support
- YAML support
- Rename service and adapter
- Publish to NPM
- JSON support
- MongoDB compatibility mode (ObjectID's)
- Alternative production configuration (Swap in a binary DB in prod/staging)
$ npm i feathers-yaml
API
yaml([options])
Returns a new database instance initialized with the given options.
import { yaml as database } from 'feathers-yaml'
export const createModel = (app: Application) => {
return database({
filename: 'users.yaml',
id: '_id', // todo: https://github.com/feathersjs/feathers/issues/2839
startId: 1,
paginate: {
default: 2,
max: 4
}
})
}
Options:
filename
(_optional, default/tmp/low-123-321.yaml
) - The full path to the fileid
(optional, default:'id'
) - The name of the id field property.startId
(optional, default:0
) - An id number to start with that will be incremented for every new record (unless it is already set).store
(optional) - An object with id to item assignments to pre-initialize the data storeevents
(optional) - A list of custom service events sent by this servicepaginate
(optional) - A pagination object containing adefault
andmax
page sizewhitelist
(DEPRECATED) - renamed toallow
allow
(optional) - A list of additional query parameters to allowmulti
(optional) - Allowcreate
with arrays andupdate
andremove
withid
null
to change multiple items. Can betrue
for all methods or an array of allowed methods (e.g.[ 'remove', 'create' ]
)
Example
Todo
License
Copyright (c) 2023 Feathers contributors
Licensed under the MIT license.