Add JSON-LD proxy server

This commit is contained in:
Pieter Vander Vennet 2024-02-22 14:59:05 +01:00
parent 50156ee3f5
commit 2af6af7630
2 changed files with 45 additions and 2 deletions

View file

@ -9,7 +9,7 @@ export class Server {
handle: {
mustMatch: string | RegExp
mimetype: string
handle: (path: string) => Promise<string>
handle: (path: string, queryParams: URLSearchParams) => Promise<string>
}[]
) {
handle.push({
@ -89,7 +89,7 @@ export class Server {
}
try {
const result = await handler.handle(path)
const result = await handler.handle(path, url.searchParams)
res.writeHead(200, { "Content-Type": handler.mimetype })
res.write(result)
res.end()