These are chat archives for gin-gonic/gin

May 2015
Ryan Brooks
May 14 2015 04:07

@manucorporat Hmmm - alright, so let's say that I want to roll out a user profile system using subdomains ( for example) that I plan to match against a regex. Part of the spec is to also match other subdomains such as, and so forth. Using Phalcon (PHP) I would have done this with something like: $profileRouter->setHostName('((?!my|groups|admin|help)([a-z\_\-0-9]{0,20}+))'); - Alternatively in Node I would have done something like:

// Middleware 
    base: app.get('base'), // returns
    alias: {
    '^[a-zA-Z0-9\-_]{3,30}': 'profile'
map.namespace('profile',  {
    subdomain: true,
    }, function(admin) {
        admin.root("apps#index", '/', {as: 'profile'});

However, when trying to replicate the same functionality I'm having a hard time, here is what I got:

Which resulted in:

[GIN-debug] GET   /                         --> main.func·001 (4 handlers)
[GIN-debug] GET   /foo                      --> main.func·002 (4 handlers)
[GIN-debug] GET   /                         --> main.func·003 (4 handlers)
panic: a handle is already registered for path ''/'

Obviously this might be a httprouter issue, but I am wondering if you have any thoughts?