Respond specified view when 404

6 views
Skip to first unread message

Jumpei Ogawa

unread,
Nov 5, 2014, 2:52:16 AM11/5/14
to ged...@googlegroups.com
Hi,

I'm developing application with frontend router (page.js)

My /config/router.js is like follows

var router = new geddy.RegExpRouter();

router.resource("users");
router.resource("companies");
router.resource("casts");


and if the user access pages which is not defined in /config/router.js
(e.g. http://localhost/tetete/ or any other), I want to always respond index.html.ejs.
Then in index.html.ejs, routing by page.js is executed.

I don't know how I can always return index.html.ejs. How can I do it?

Matthew Eernisse

unread,
Nov 6, 2014, 2:03:46 PM11/6/14
to ged...@googlegroups.com
That sounds like something you could solve with a wildcard route. Geddy uses the Barisata router (https://github.com/kieran/barista), which support this. Since routes get matched top to bottom, putting the wildcard last should work.

Hope this helps.

--
The official community discussion group.
website: geddyjs.org, source: https://github.com/mde/geddy, group: https://groups.google.com/d/forum/geddyjs?hl=en
---
You received this message because you are subscribed to the Google Groups "GeddyJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geddyjs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jumpei Ogawa

unread,
Nov 6, 2014, 10:09:45 PM11/6/14
to ged...@googlegroups.com
Matthew,

Thanks you!

I add

router.get('/*pagejs').to("Main.pagejs");

and Main.pagejs controller successfully worked.
--
Jumpei Ogawa (a.k.a. phanect)

Matthew Eernisse

unread,
Nov 8, 2014, 11:26:36 PM11/8/14
to ged...@googlegroups.com
Excellent! Glad you were able to get it sorted out.
Reply all
Reply to author
Forward
0 new messages