2023-07-23 00:32:54 +09:00
|
|
|
import { Handlers } from "$fresh/server.ts";
|
2023-10-26 23:58:33 +09:00
|
|
|
import { db } from "../../db/db.ts";
|
2023-07-23 00:32:54 +09:00
|
|
|
|
|
|
|
export const handler: Handlers = {
|
|
|
|
async GET(req, _ctx): Promise<Response> {
|
|
|
|
const headers = new Headers({
|
|
|
|
"content-type": "application/json"
|
|
|
|
});
|
2023-10-26 23:58:33 +09:00
|
|
|
const rows = await db.selectFrom("KOSPI")
|
|
|
|
.select([
|
|
|
|
"Code",
|
|
|
|
"Name"
|
|
|
|
])
|
|
|
|
.execute();
|
|
|
|
return new Response(JSON.stringify(rows), {headers});
|
2023-07-23 00:32:54 +09:00
|
|
|
},
|
|
|
|
}
|