Page MenuHomeSealhub

tasks.ts
No OneTemporary

tasks.ts

import Router from "@koa/router";
import { Middlewares } from "sealious";
import { MainView } from "./homepage";
const router = new Router();
router.post(
"/",
Middlewares.extractContext(),
Middlewares.parseBody(),
async (ctx) => {
await ctx.$app.collections.tasks
.make({
title: ctx.$body.title as string,
done: false,
})
.save(ctx.$context);
ctx.body = MainView(ctx);
}
);
router.delete("/:task_id", Middlewares.extractContext(), async (ctx) => {
const task = await ctx.$app.collections.tasks.getByID(
ctx.$context,
ctx.params.task_id
);
await task.remove(ctx.$context);
ctx.body = MainView(ctx);
});
export default router;

File Metadata

Mime Type
text/x-java
Expires
Fri, Jan 24, 11:44 (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
601597
Default Alt Text
tasks.ts (664 B)

Event Timeline