Router questions

Hi all.

I'm experimenting with Router but can't get it to work. I read through the documentation and the other posts on here re: it and perhaps I'm misunderstanding what it's meant for.

My understanding was that I should be able to type something like http://mywebsitename/myappname/paging and I can direct the user to the paging module of my app. Is my understanding correct?

If so, when I do this, I get a "file/directory not found" web server error, which I guess makes sense since web server can't find that location! Do I need to make some kind of web server configuration change (Apache) to support this?

Also, should things like: http://mywebsitename/myappname/debug.html/paging work?

Thanks,
Cage

Comments

  • So, you'll need to configure your web server to return the same page for all the URLs in the app tree. If you change state in your app, you use the HTML pushState API to change the active URL without reloading the page, and that lets the router reconfigure things.

    We don't have a good tutorial for it yet, alas.
  • edited January 2014
    The router is also hash based, so it needs to be http://mywebsitename/myappname/#/debug

    I believe using the hash makes it IE8 compatible, and is fairly standard in client side routing now.
  • Here is a simplified dumb-down router we used. The error path for example is:
    http://mywebsitename/myappname/#/errors/401
    
    enyo.kind({
    	kind: 'Router',
    	history: true,
    	links: [],
    	routes: [{ // DEFAULT PAGE (HOME)
    			path: '/main',
    			default: true,
    			handler: 'changeScreen',
    			context: {}
    	}, { // ERRORS (401)
    			path: '/errors/401',
    			handler: 'changeScreen',
    			context: {}
    	}],
    
    	changeScreen: function () {
    		enyo.Signals.send('appChangeHandler', this);
    	}
    });
    
  • oh right... I was thinking hash support wasn't implemented, but its non-hash support that's not there right now instead.
Sign In or Register to comment.