Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -235,4 +235,8 @@ fabric.properties
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

.idea
.idea

*.sum
LRU.go
*.exe
36 changes: 36 additions & 0 deletions graphite-demo/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const express = require('express');
const app = express();
const port = 3000;

// Fake data for tasks
const tasks = [
{
id: 1,
description: 'Complete monthly financial report'
},
{
id: 2,
description: 'Plan team building activity'
},
{
id: 3,
description: 'Update project documentation'
}
];

app.get('/search', (req, res) => {
// Retrieve the query parameter
const query = req.query.query?.toLowerCase() || '';

// Filter tasks based on the query
const filteredTasks = tasks.filter(task => task.description.toLowerCase().includes(query));

// Sort the filtered tasks alphabetically by description
const sortedTasks = filteredTasks.sort((a, b) => a.description.localeCompare(b.description));

res.json(sortedTasks);
});

app.listen(port, () => {
console.log(`Server running on port ${port}`);
});
Loading