Skip to content

Commit

Permalink
Add server API
Browse files Browse the repository at this point in the history
  • Loading branch information
mattleesounds committed Jun 14, 2024
1 parent 0149672 commit 5c6a983
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions graphite-demo/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
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));

res.json(filteredTasks);
});

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

0 comments on commit 5c6a983

Please sign in to comment.