()
| 1 | import {MiddlewareHandler} from 'hono'; |
| 2 | |
| 3 | export const allowOnlyPost = (): MiddlewareHandler => { |
| 4 | return async function allowOnlyPost(c, next) { |
| 5 | if (c.req.method !== 'POST') { |
| 6 | return c.json({message: 'Bad Request - Only POST requests allowed.'}, 400); |
| 7 | } |
| 8 | await next(); |
| 9 | }; |
| 10 | }; |