trilium/src/routes/api/autocomplete.js
2018-06-05 22:47:47 -04:00

20 lines
No EOL
403 B
JavaScript

"use strict";
const noteCacheService = require('../../services/note_cache');
async function getAutocomplete(req) {
const query = req.query.query;
const results = noteCacheService.findNotes(query);
return results.map(res => {
return {
value: res.title + ' (' + res.path + ')',
label: res.title
}
});
}
module.exports = {
getAutocomplete
};