Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Controllers acting fuzzy

38 views
Skip to first unread message

fom...@yahoo.it

unread,
Apr 8, 2014, 6:44:43 PM4/8/14
to tot...@googlegroups.com
Hello, and first of all thank you for your framewok.
It's my first experience with node, and I wanted to do a "hands on" thing, so didn't go much through the docs. But now that I'm finding some problems, even the docs aren't helping.

I'm developing a hobby website, it's an information aggregator/dashboard for cryptocurrencies, an alpha/proof-of-concept is available at http://1dash.net

I'm having some strange issues with controllers.
Two days ago I defined a websocket with some routes. They didn't work. When I moved the websockets to a diffrent file, they did work. Now they are sitting in a dedicated file. This is the controller that didn't work (moved the websocket)
exports.install = function(framework) {
    framework.route('/exchanges', get_exchange_list);
    framework.route('/exchanges/{exchange}/{left}/{right}', get_exchange);
    framework.websocket('/exchangesws/{exchange}/{left}/{right}', get_exchange_updates, ['json']);
};


Then yesterday I had an issue with ['authorize']. It looked like the order of the routes mattered when I define the routes, so I had to set them up this way:
exports.install = function(framework) {
    framework.route('/', view_homepage_logged, ['authorize']);
    framework.route('/', view_homepage);
    [...]
}


But now (I may have updated the framework version by accident, can't remember) it isn't working again, and both logged-in and not-logged-in users get the same route.
(this seems to be fixed if I invert the order again).

So can I ask what is the recomended order for routing, and what could have been the issue with the websockets?

Thank you for your time, and as a first timer to node, I find your framework very useful, (these issues aside) it's really out-of-the-way and gives a lot of freedom.

Peter Širka

unread,
Apr 10, 2014, 12:01:04 PM4/10/14
to tot...@googlegroups.com
Hello,
can you send me a small example? I must see it.
I'll test it.

E-mail: petersirka(at)gmail(dot)com

fom...@yahoo.it

unread,
Apr 12, 2014, 8:16:00 PM4/12/14
to tot...@googlegroups.com
Things seem to be fixed with the latest version.
Can't reproduce anymore.
Thank you very much!

fom...@yahoo.it

unread,
Apr 13, 2014, 1:57:42 PM4/13/14
to tot...@googlegroups.com
I have another question, though.
How do I set the framework to not minify (client-side) javascripts?

Peter Širka

unread,
Apr 13, 2014, 2:21:45 PM4/13/14
to tot...@googlegroups.com
Configuration:
allow-compile-js                   : false
allow-compile-css                  : false

or

filename of script or css must contain mystyle.min.css or myscript.min.js.

Thanks :-)

fom...@yahoo.it

unread,
Apr 19, 2014, 10:44:28 AM4/19/14
to tot...@googlegroups.com
Hello Peter, I have a new issue, similar to previous. I seem to have hit a max number of routes?
My app (you can check it out here: 1dash.net) has lots of different async calls form browsers so I have lots of routs.
Now I've added a couple of new routes, and my app has started to route '/' wrong.

Here's the default.js code:
exports.install = function(framework) {
    framework.route('/', view_homepage);

    framework.route('/', view_homepage_logged, ['authorize']);
    // more routes follow....
}


function view_homepage() {
    var self = this;
    self.view('login');
};

function view_homepage_logged() {
    var self = this;
    self.view('dashboard');
};


When a user is not logged in, I'll show the loginpage. Else I'll show a dashboard (you can check it out, creating a throwaway account will take you 5 seconds).

Now, I'm adding more functionality. At a certain point, after I added yet another route, the '/' route stopped working.
I can deterministacally turn the bug on and off, by adding or commenting out a new route.
Am I missing out on something?

I can provide full source code if needed.


fom...@yahoo.it

unread,
Apr 19, 2014, 11:16:45 AM4/19/14
to tot...@googlegroups.com
The exact problem, is that '/' sends me to the login page regardless if the user is logged in or not.

Peter Širka

unread,
Apr 19, 2014, 12:40:53 PM4/19/14
to
Please send me full source code on my e-mail petersirka(at)gmail(dot)com.
Thanks :-)
Reply all
Reply to author
Forward
0 new messages