diff --git a/src/classes/ComplexController/index.js b/src/classes/ComplexController/index.js index e923df3..5ad905f 100644 --- a/src/classes/ComplexController/index.js +++ b/src/classes/ComplexController/index.js @@ -29,13 +29,14 @@ export default class ComplexController { global.VALID_HTTP_METHODS.forEach((httpMethod) => { if (typeof this[httpMethod] === "object") { + const fixedMethod = global.FIXED_HTTP_METHODS[httpMethod] const controllerMethods = Object.keys(this[httpMethod]) controllerMethods.forEach((methodKey) => { const fn = this[httpMethod][methodKey] let endpoint = { - method: httpMethod, + method: fixedMethod, route: methodKey, middlewares: [], fn: fn, diff --git a/src/server/index.js b/src/server/index.js index d3fd50f..9147a83 100755 --- a/src/server/index.js +++ b/src/server/index.js @@ -14,7 +14,10 @@ const { randomWord } = require("@corenode/utils") const { serverManifest } = require("../lib") global.LOCALHOST_ADDRESS = net.ip.getHostAddress() ?? "localhost" -global.VALID_HTTP_METHODS = ["get", "post", "put", "patch", "del", "trace", "head", "any", "options", "ws"] +global.FIXED_HTTP_METHODS = { + "delete": "del", +} +global.VALID_HTTP_METHODS = ["get", "post", "put", "patch", "del", "delete", "trace", "head", "any", "options", "ws"] global.DEFAULT_HEADERS = { "Access-Control-Allow-Headers": "Origin, X-Requested-With, Content-Type, Accept, Authorization", "Access-Control-Allow-Origin": "*",