xp
xp copied to clipboard
Support aliases for HTTP methods in controllers
Problem 1:
Handler for delete
method in an HTTP controller is currently defined as "exports.delete = function()...
". However, developers who are using Javascript module syntax have to define it like this: export function delete...
. "delete"
is a reserved word in Javascript.
Problem 2:
Handler for get
method in Javascript module syntax is defined like this: export function get...
.
If developer in the same module imports get
method of, let's say, lib-content like this "import {get} from 'lib/xp/content'
" then the http handler get
conflicts with the library method get
.
Both issues could've been solved if we introduce aliases for HTTP controller methods: http_delete
(or httpDelete
) for delete
, http_get
for get
etc.
I think httpDelete
is a better and more traditional JavaScript naming of functions, instead of http_delete
.