Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server.all and non-mandatory param #18

Closed
diorahman opened this issue Jul 12, 2012 · 3 comments
Closed

server.all and non-mandatory param #18

diorahman opened this issue Jul 12, 2012 · 3 comments

Comments

@diorahman
Copy link

Can we define an endpoint to handle all verbs? and define non-mandatory params as in Express?

for example:

server.all('/svc/:id/:connectionType?', function(req, res){

})

Where all means we will handle all verbs while ? defines non-mandatory param of connectionType

Thanks!

@kilianc
Copy link
Owner

kilianc commented Jul 12, 2012

to define a catchall simply don't use an object as endpoint:

apiServer.addModule('1', 'fooModule', {
  foo: function (request, response) {
    // all http verbs
  }
})

in apiserver all parameters are optional

'/svc/:id/:connectionType' matches

/svc/50/tcp
/svc/50/
/svc/50
/svc/
/svc

@diorahman
Copy link
Author

Thanks

@kilianc
Copy link
Owner

kilianc commented Jul 12, 2012

you're welcome! 👊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants