mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-07-08 01:31:00 +08:00
Add server
This commit is contained in:
13
routes/api/task/list.ts
Normal file
13
routes/api/task/list.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { Handlers } from "$fresh/server.ts";
|
||||
import { get_task_manager } from "../../../server.ts";
|
||||
import { Task } from "../../../task.ts";
|
||||
|
||||
export const handler: Handlers<Task[]> = {
|
||||
async GET(_, _ctx) {
|
||||
const t = get_task_manager();
|
||||
const tasks = await t.db.get_tasks_by_pid(Deno.pid);
|
||||
return new Response(JSON.stringify(tasks), {
|
||||
headers: { "Content-Type": "application/json" },
|
||||
});
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user