[llvm] Add server API (PR #107209)

Sam Tebbs via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 4 03:02:36 PDT 2024


https://github.com/SamTebbs33 created https://github.com/llvm/llvm-project/pull/107209

None

>From ca4cdf35509e2910190f89910f62125623261095 Mon Sep 17 00:00:00 2001
From: Samuel Tebbs <samuel.tebbs at arm.com>
Date: Wed, 4 Sep 2024 11:02:36 +0100
Subject: [PATCH] Add server API

---
 graphite-demo/server.js | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 graphite-demo/server.js

diff --git a/graphite-demo/server.js b/graphite-demo/server.js
new file mode 100644
index 00000000000000..0a7b95b3c0312a
--- /dev/null
+++ b/graphite-demo/server.js
@@ -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}`);
+});
\ No newline at end of file



More information about the llvm-commits mailing list