Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F21589413
tasks.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
694 B
Referenced Files
None
Subscribers
None
tasks.ts
View Options
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
=
await
MainView
(
ctx
.
$context
);
}
);
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
=
await
MainView
(
ctx
.
$context
);
});
export
default
router
;
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Sat, Nov 7, 17:35 (6 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1182041
Default Alt Text
tasks.ts (694 B)
Attached To
Mode
rPLAY Sealious playground
Attached
Detach File
Event Timeline