From 8b76a6f8bf44d52e05c65c2c945411eda98c2d27 Mon Sep 17 00:00:00 2001 From: anthony4m Date: Tue, 14 Jan 2025 15:49:17 +0000 Subject: [PATCH 1/2] { refactored, Some tests fail, but because we switched to slotted pages } --- .gitignore | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index c38b417..9d57a3a 100644 --- a/.gitignore +++ b/.gitignore @@ -235,4 +235,8 @@ fabric.properties # Android studio 3.1+ serialized cache file .idea/caches/build_file_checksums.ser -.idea \ No newline at end of file +.idea + +*.sum +LRU.go +*.exe From c2d1a4c25ede3071bd3706eb38fab771503732ac Mon Sep 17 00:00:00 2001 From: anthony4m Date: Tue, 14 Jan 2025 16:11:21 +0000 Subject: [PATCH 2/2] Add server API --- graphite-demo/server.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 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 0000000..cf7ec65 --- /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