add trigger route

This commit is contained in:
Thomas Ruoff
2022-06-23 23:52:20 +02:00
parent 8c0674f9d9
commit 634d460df1
2 changed files with 20 additions and 2 deletions

19
pages/api/mailtrigger.ts Normal file
View File

@@ -0,0 +1,19 @@
import { log } from '../../helpers/log'
import { NextApiRequest, NextApiResponse } from 'next'
export default async function useHandler(
req: NextApiRequest,
res: NextApiResponse
): Promise<void> {
const { method } = req
switch (method) {
case 'GET':
log.info('sending mail triggered')
res.statusCode = 200
break
default:
res.setHeader('Allow', ['GET'])
res.status(405).end(`Method ${method} Not Allowed`)
}
}