denobox/myapp/todo.ts
2023-02-08 17:58:47 +01:00

18 lines
351 B
TypeScript

export class Todo {
something?: boolean;
constructor(private readonly id: string, private content: string) {}
// Update the todo's content.
setContent(content: string) {
this.content = content;
}
}
/**
* @post /api/todos
*/
export function createTodo(content: string): Todo {
return new Todo(new Date().toISOString(), content);
}