Local filesystem Api Documentation loader for [labyrinth](https://npm.im/@hydrofoil/labyrinth)
npm install @hydrofoil/minotaurLocal filesystem Api Documentation loader for labyrinth
You create a directory with Turtle files containing the whole hydra:ApiDocumentation resource which will be served linked to all API responses served by labyrinth. These files will be parsed when the app starts. A minimal API could be a single file, but multiple are supported loaded form all subdirectories.
``turtle
@base
@prefix hydra:
@prefix rdfs:
a hydra:ApiDocumentation ;
hydra:supportedClass , ;
.
a hydra:Class ;
hydra:title "To-do item" ;
.
a hydra:Class ;
rdfs:subClassOf hydra:Collection ;
hydra:title "To-do list" ;
.
`
`typescript
import express from 'express'
import { hydraBox } from '@hydrofoil/labyrinth'
import { fromFilesystem } from '@hydrofoil/minotaur'
const app = express()
app.use(await hydraBox({
loadApi: fromFilesystem({
apiPath, // directory with the API Documentation sources
baseUri, // base resource URI
defaultBase, // (optional) base URL used in RDF sources
})
}))
`
If the defaultBase is provided, use it instead of @base