mirror of
https://github.com/zadam/trilium.git
synced 2025-12-24 00:59:55 +01:00
ETAPI openapi spec WIP
This commit is contained in:
20
src/etapi/spec.js
Normal file
20
src/etapi/spec.js
Normal file
@@ -0,0 +1,20 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const specPath = path.join(__dirname, 'spec.openapi.yaml');
|
||||
let spec = null;
|
||||
|
||||
function register(router) {
|
||||
router.get('/etapi/spec.openapi.yaml', (req, res, next) => {
|
||||
if (!spec) {
|
||||
spec = fs.readFileSync(specPath, 'utf8');
|
||||
}
|
||||
|
||||
res.header('Content-Type', 'text/plain'); // so that it displays in browser
|
||||
res.status(200).send(spec);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
register
|
||||
};
|
||||
Reference in New Issue
Block a user