mirror of
https://github.com/zadam/trilium.git
synced 2024-11-15 20:33:12 +08:00
bd2a5f6d82
added assert methods to note tree
25 lines
No EOL
534 B
JavaScript
25 lines
No EOL
534 B
JavaScript
"use strict";
|
|
|
|
const express = require('express');
|
|
const router = express.Router();
|
|
const auth = require('../../services/auth');
|
|
const sql = require('../../services/sql');
|
|
|
|
router.post('/execute', auth.checkApiAuth, async (req, res, next) => {
|
|
const query = req.body.query;
|
|
|
|
try {
|
|
res.send({
|
|
success: true,
|
|
rows: await sql.getAll(query)
|
|
});
|
|
}
|
|
catch (e) {
|
|
res.send({
|
|
success: false,
|
|
error: e.message
|
|
});
|
|
}
|
|
});
|
|
|
|
module.exports = router; |