seagull-js/seagull

View on GitHub
examples/helloworld/src/routes/crud/delete.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { Route, RouteContext } from '@seagull/routes'
import { Term } from '../../items/index'

export default class extends Route {
  static method = 'POST' as const
  static path = '/glossary/delete'

  static async handler(this: RouteContext) {
    const { word } = this.request.body
    await Term.delete(word)
    this.redirect('/glossary')
  }
}