@partrocks/data
v0.4.0
Published
Simple Data connector and Schema for Database PartRocks connection
Downloads
2
Readme
@partrocks/data
@partrocks/data is a npm package PartRocks that allows a configured environment to access the platform data sources.
Installation
Use the package manager npm to install to node_modules.
npm install @partrocks/data
Usage (nodejs)
const { connectDatasources } = require("@partrocks/data")
connectDatasources(() => {
console.log("PartRocks datasources are now ready!")
})
...or with import syntax
import { connectDatasources } from "@partrocks/data"
connectDatasources(() => {
console.log("PartRocks datasources are now ready!")
})
Model Usage
for now the only datasource available is via mongoDB and this is essentially a wrapper for mongoose models
import { User } from "@partrocks/data"
// Its a mongoose model - so this works
const rick = new User({
email: "[email protected]"
})
await rick.save()
Note
The API for the models is subject to change prior to version 1.0.x I hope to keep it vaguely in line with the existing style but obv is subject to change.
Contributing
Get in touch [email protected]