seagull-js/seagull

View on GitHub
examples/helloworld/src/routes/item_route.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { Item } from '@seagull/plugin-items'
import { Route, RouteContext } from '@seagull/routes'

class Todo extends Item {
  id: string

  constructor(id: string) {
    super()
    this.id = id
  }
}

export default class ItemRoute extends Route {
  static path = '/items'
  static async handler(this: RouteContext) {
    await Todo.put({ id: 'first!' })
    const list = await Todo.all()
    this.html('items: ' + JSON.stringify(list))
  }
}