trilium/src/routes/api/autocomplete.js

20 lines
412 B
JavaScript
Raw Normal View History

2018-04-18 12:26:42 +08:00
"use strict";
const autocompleteService = require('../../services/autocomplete');
async function getAutocomplete(req) {
const query = req.query.query;
const results = autocompleteService.getResults(query);
return results.map(res => {
return {
value: res.title + ' (' + res.path + ')',
2018-04-18 12:26:42 +08:00
title: res.title
}
});
}
module.exports = {
getAutocomplete
};