This commit is contained in:
Janis
2023-01-02 19:04:43 +01:00
parent 618b300bef
commit 6ed3cc22f3
3 changed files with 80 additions and 3 deletions

View File

@@ -7,9 +7,10 @@ export default async function search(req, res) {
query = query.toLowerCase().replaceAll("%20", "");
query = query.toLowerCase().replaceAll(" ", "");
if (query.length > 2) {
if (query.length > 1) {
const articles = await prisma.article.findMany({
select: { title: true, name: true },
take: 5,
}); //TODO order by most viewed
let result = [];