diff --git a/app/pages/ama.vue b/app/pages/ama.vue new file mode 100644 index 00000000..f7e351fc --- /dev/null +++ b/app/pages/ama.vue @@ -0,0 +1,74 @@ + + + + + + + ask me anything + + + + + ask anonymously + + + + + question submitted successfully! + + + + go home + + + + + an error occurred + + + + + + diff --git a/server/api/hi.ts b/server/api/hi.ts deleted file mode 100644 index 11fa987f..00000000 --- a/server/api/hi.ts +++ /dev/null @@ -1,9 +0,0 @@ -export default defineEventHandler(async event => { - if (getMethod(event) === 'OPTIONS') return null - assertMethod(event, 'POST') - const { body } = await readBody(event) - if (!body) throw createError({ statusCode: 422 }) - - await sendEmail('Hi there', body) - return null -}) diff --git a/server/api/question.ts b/server/api/question.ts new file mode 100644 index 00000000..9ba427ab --- /dev/null +++ b/server/api/question.ts @@ -0,0 +1,10 @@ +export default defineEventHandler(async event => { + if (event.method === 'OPTIONS') return null + + assertMethod(event, 'POST') + const { question } = await readBody(event) + if (!question) throw createError({ statusCode: 422 }) + + await sendEmail('Anonymous question', question) + return null +})
+ question submitted successfully! +
+ + go home + +
+ an error occurred +