We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fcd73e9 commit 4bb8e28Copy full SHA for 4bb8e28
app/json-api/platforms.json/route.ts
@@ -0,0 +1,17 @@
1
+import {extractPlatforms, getDocsRootNode} from 'sentry-docs/docTree';
2
+
3
+export const GET = async (_request: Request) => {
4
+ const rootNode = await getDocsRootNode();
5
+ // this regex deals with names like .NET that would otherwise be sorted at the top
6
+ const leadingNonAlphaRegex = /^[^\w]/;
7
+ // sort the platforms alphabetically
8
+ const sortedPlatforms = extractPlatforms(rootNode).sort((a, b) =>
9
+ (a.title ?? a.name)
10
+ .replace(leadingNonAlphaRegex, '')
11
+ .localeCompare((b.title ?? b.name).replace(leadingNonAlphaRegex, ''))
12
+ );
13
14
+ return new Response(JSON.stringify(sortedPlatforms), {
15
+ headers: {'content-type': 'application/json'},
16
+ });
17
+};
0 commit comments