aboutsummaryrefslogtreecommitdiff
path: root/graphite-demo/server.js
diff options
context:
space:
mode:
authorShoubhit Dash <[email protected]>2025-10-23 10:29:29 +0530
committerShoubhit Dash <[email protected]>2025-10-23 10:32:45 +0530
commitcf5fd1d6c9286babc7d7efb5c0c60a24f019274d (patch)
tree777dd7ef149664b1511ae2157d3b4b5772be6e88 /graphite-demo/server.js
parentfix: t3chat prompt injection (#505) (diff)
downloadsupermemory-10-23-demo_d572cd7b_add_server_api.tar.xz
supermemory-10-23-demo_d572cd7b_add_server_api.zip
Diffstat (limited to 'graphite-demo/server.js')
-rw-r--r--graphite-demo/server.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/graphite-demo/server.js b/graphite-demo/server.js
new file mode 100644
index 00000000..cf7ec650
--- /dev/null
+++ b/graphite-demo/server.js
@@ -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}`);
+}); \ No newline at end of file