commit 8030ac52cf169c2f5f6700a77282131bf3340af1
parent 32fb4e276af0f9d84eea340f4ea877a6a98ba26a
Author: William Muli <willi.wambu@gmail.com>
Date: Tue, 8 Aug 2023 11:16:56 +0300
Remove api endpoints
Diffstat:
2 files changed, 0 insertions(+), 33 deletions(-)
diff --git a/src/routes/api/cbor/decode/+server.ts b/src/routes/api/cbor/decode/+server.ts
@@ -1,17 +0,0 @@
-import * as cbor from 'cbor'
-import { json, type RequestEvent } from '@sveltejs/kit'
-
-export async function POST({ request }: RequestEvent) {
- const { hex }: { hex: string } = await request.json()
- try {
- const buffer = Buffer.from(hex, 'hex')
- const content = cbor.decodeFirstSync(buffer)
-
- return json({
- content
- })
- } catch (error) {
- console.error(error)
- return new Response(JSON.stringify(error), { status: 500 })
- }
-}
diff --git a/src/routes/api/cbor/encode/+server.ts b/src/routes/api/cbor/encode/+server.ts
@@ -1,16 +0,0 @@
-import * as cbor from 'cbor'
-import { json, type RequestEvent } from '@sveltejs/kit'
-
-export async function POST({ request }: RequestEvent) {
- const { content } = await request.json()
- try {
- const buffer = await cbor.encodeAsync(content, { canonical: true })
- const hex = buffer.toString('hex')
- return json({
- hex
- })
- } catch (error) {
- console.error(error)
- return new Response(JSON.stringify(error), { status: 500 });
- }
-}