mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 10:55:55 +01:00
backend autocomplete WIP
This commit is contained in:
20
src/routes/api/autocomplete.js
Normal file
20
src/routes/api/autocomplete.js
Normal file
@@ -0,0 +1,20 @@
|
||||
"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 + ')',
|
||||
title: res.title
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getAutocomplete
|
||||
};
|
||||
Reference in New Issue
Block a user