Open kumavis opened 9 years ago
Not yet, no. That's a good idea though and a good candidate for extension for the router module. Are you using http-master from code or standalone?
What syntax do you propose for this functionality?
{ ":inbox_tray:domain/* ": "3000/get/[1]", ":postbox:domain/* ": "2000/post/[1]" }
json supports emoji, right? :ghost:
:rabbit:
So i don't have much experience with this project -- what characters are not parsed currently?
this seems straightforward enough, but might conflict a bit
{
"GET:domain/* ": "3000/get/[1]",
"POST:domain/* ": "2000/post/[1]"
}
we could do whatever is easiest really
{
"GET=domain/* ": "3000/get/[1]",
"POST=domain/* ": "2000/post/[1]"
}
and i mean easiest not just out of laziness but also keeping the code simple and maintainable
how about this?
ports: {
80: {
router: {
'domain/*': {
GET: '3000/get/[1]',
POST: '2000/post/[1]'
}
}
}
}
@Rush CAPS is waste of keystrokes, btw, get
or post
would be sufficient and equally semantic. :)
Caps are needed to differentiate domains from http actions. Domains would be low caps.
i like that expansion. would you need to differentiate if you were using an object like that?
ports: {
"80": {
"router": {
"domain/*": {
"domain": "3000/get/[1]",
"ACTION": "2000/post/[1]"
}
}
}
}
In your example "domain" is already matched so it would be:
ports: {
"80": {
"router": {
"domain/*": {
"ACTION": "2000/post/[1]",
"*": "3000/get/[1]"
}
}
}
}
@Rush But domain is already defined in "domain/*"
, so having another domain one level deeper doesn't make sense, no?
If the "domain" matches couple of times no harm is done but as I've posted, it wouldn't be necessary.
:+1: :smile_cat:
Is it possible to route based on HTTP Method, e.g. GET/POST ?