Browse Source

fix backend detection

master
Milan Pässler 11 months ago
parent
commit
3d1087647a
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      server/index.js

+ 3
- 3
server/index.js View File

@@ -24,16 +24,16 @@ http.createServer(async (req, stream) => {

let res;
try {
if (parameters.length < 3) {
if (parameters.length < 2) {
throw new HTTPError(404, "Invalid URI");
}

const backend = backends[parameters[2]];
const backend = backends[parameters[1]];
if (!backend) {
throw new HTTPError(404, "Invalid Backend");
}

res = await backend(parameters.splice(3));
res = await backend(parameters.splice(2));
} catch(err) {
if (err instanceof HTTPError) {
stream.writeHead(err.code, { "Content-Type": "text/plain" });


Loading…
Cancel
Save