mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 06:27:11 +01:00
add trigger route
This commit is contained in:
19
pages/api/mailtrigger.ts
Normal file
19
pages/api/mailtrigger.ts
Normal 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`)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user