We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c882c22 commit 7167890Copy full SHA for 7167890
web/src/routes/demo.yml/+server.ts
@@ -0,0 +1,22 @@
1
+import { error } from '@sveltejs/kit';
2
+
3
+export async function GET() {
4
+ const schemaURL = "https://raw.githubusercontent.com/gttp-cli/gttp/main/_examples/demo.yml";
5
6
+ try {
7
+ const response = await fetch(schemaURL);
8
+ if (!response.ok) {
9
+ throw new Error('Failed to fetch schema');
10
+ }
11
+ const data = await response.json();
12
13
+ return new Response(JSON.stringify(data), {
14
+ headers: {
15
+ 'Content-Type': 'application/json'
16
17
+ });
18
+ } catch (e) {
19
+ // Handle errors or invalid responses
20
+ throw error(500, `Error fetching schema: ${e.message}`);
21
22
+}
web/test.yml
0 commit comments