From 751392b6dcc63f6bb973561ee976e699b9540db4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Roub=C3=AD=C4=8Dek?= Date: Mon, 12 Dec 2022 14:39:08 +0100 Subject: [PATCH] Make deno deploy function from reader --- reader/index.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/reader/index.js b/reader/index.js index ad67a51..c9b89c5 100644 --- a/reader/index.js +++ b/reader/index.js @@ -1,6 +1,14 @@ +import { serve } from "https://deno.land/std@0.155.0/http/server.ts"; import { parse } from "https://deno.land/x/xml/mod.ts"; -const text = await Deno.readTextFile("../XONE K2 - 4 decks (Live FX).xml"); -const xml = parse(text); +/** + * @param {Request} req + * @return {Promise} + */ +export async function handler(req) { + const text = await req.text(); + const xml = parse(text); + return Response.json(xml); +} -console.log(JSON.stringify(xml, null, 2)); +serve(handler);