add authed method

This commit is contained in:
FullGreaM 2025-03-13 20:09:24 +03:00
parent d2bc7d5dd4
commit f01ecdf5a8
2 changed files with 13 additions and 4 deletions

View File

@ -74,13 +74,22 @@ class API {
} = request;
if (!method)
return cb({
error: "method missed"
error: "method missed",
ended: true
});
if (!trace_id)
return cb({
error: "trace_id missed"
error: "trace_id missed",
ended: true
});
return this.methods[method]?.(connection, request, cb);
const selmethod = this.methods[method];
if (selmethod === undefined)
return cb({
error: "unknown method: " + method,
trace_id,
ended: true
});
return selmethod(connection, request, cb);
} else {
return cb({
error: "required JSON-object based request"

View File

@ -1,4 +1,4 @@
module.exports = function (con, req, cb) {
return cb({ error: "At develop" });
return cb({ error: "At develop", trace_id: req.trace_id, ended: true });
//;
};