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 8c73cf1 commit e863443Copy full SHA for e863443
docs/server/api/templates.json.get.ts
@@ -0,0 +1,26 @@
1
+import { handleCors } from 'h3'
2
+
3
+export default defineEventHandler(async (event) => {
4
+ const didHandleCors = handleCors(event, {
5
+ origin: ['https://nuxt.studio', 'https://dev.nuxt.studio'],
6
+ preflight: {
7
+ statusCode: 204,
8
+ },
9
+ methods: '*',
10
+ })
11
12
+ if (didHandleCors) {
13
+ return
14
+ }
15
16
+ const templates = await queryCollection(event, 'templates').all()
17
18
+ if (!templates) {
19
+ throw createError({
20
+ statusCode: 404,
21
+ statusMessage: 'Templates not found',
22
23
24
25
+ return templates
26
+})
0 commit comments