Skip to content
Draft
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
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();

Check warning on line 2 in graphite-demo/server.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

This framework implicitly discloses version information by default. Make sure it is safe here.

See more on https://sonarcloud.io/project/issues?id=Cap-go_capgo&issues=AZ-0-b_mxHV1Enipw7ik&open=AZ-0-b_mxHV1Enipw7ik&pullRequest=2796

Check notice

Code scanning / SonarCloud

Web application technologies should not disclose version information Low

This framework implicitly discloses version information by default. Make sure it is safe here. See more on SonarQube Cloud
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));

Check warning on line 29 in graphite-demo/server.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Move this array "sort" operation to a separate statement or replace it with "toSorted".

See more on https://sonarcloud.io/project/issues?id=Cap-go_capgo&issues=AZ-0-b_mxHV1Enipw7il&open=AZ-0-b_mxHV1Enipw7il&pullRequest=2796

res.json(sortedTasks);
});

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