Middleware
Dubnium has built-in Express middleware functions to manage Records. Data is never sent to the client without your permission.
Parameters
Parameter
About
Type
Required
tag
First param to set tag info.
Object
tag.from
Part of the req object to get the tag from (e.g. headers or body)
String
tag.key
Key from the from object to get tag from.
String
content
Second param to set content info
Object
content.from
Part of the req object to get the content from (e.g. headers or body)
String
content.key
Key from the from object to get tag from.
String
Methods
Create
app.get('/new', db.middleware.create({ from:"query", key:"tag" }, { from:"query", key:"content" }), (req, res) => {
// Creates a record with the tag and content from the query
})Get
app.get('/:tag', db.middleware.get({ from:"params", key:"tag" }), (req, res) => {
// Access the record directly from req.record, if it exists
})DB
Delete
Edit
Other
Full Example
Last updated
Was this helpful?