kieran / barista

A URL router / generator for NodeJS
https://kieran.github.io/barista/
MIT License
111 stars 22 forks source link

Id parameter can not content dots #20

Closed misterjt closed 11 years ago

misterjt commented 11 years ago

It's sad! i need an url like this /sites/site.ru/edit for my admin panel, but when i'm trying to generate this

router.get('/sites/:id/edit').to('sites.edit');
router.url({controller:'sites',action:'edit',id:'site.ru'})

I'm gettin '/sites/false/edit' Please, tell me what to do?

kieran commented 11 years ago

The default regex for path variables is /[\w\-\s]+/

You can override this to include periods on a per-key basis like so:

router.get('/sites/:id/edit').to('sites.edit').where( { id: /[\w\-\s.]+/ } )