Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tutorial 12, missing "No dice!" #64

Closed
nnoodle opened this issue May 6, 2021 · 6 comments
Closed

Tutorial 12, missing "No dice!" #64

nnoodle opened this issue May 6, 2021 · 6 comments

Comments

@nnoodle
Copy link

nnoodle commented May 6, 2021

The default router never gets to say "No Dice!". On tutorial 12, when going to a route that is not /tutorial/tut-11.html nor any of the other handled paths like /page1, it instead says "Not Found".

@rabbibotton
Copy link
Owner

Sorry for delay. I am not sure what the issue is? CLOG generally deals with all routing beyond routes static-files/ Is there something you are looking to accomplish?

@nnoodle
Copy link
Author

nnoodle commented May 11, 2021

Thanks for the reply! What I want to accomplish is being able to route things in a way much like easy-routes, so that I could define a route like /foo/:x/:y and get whatever is :x and :y was, and it looked like using the "default" path was the entry point to do that.

But I wasn't able to get my default handler to do its thing, so I looked to the tutorial. What the on-default handler looks like it does if none of the other paths match is: it'll run on-tutorial11 if the pathname is "/tutorial/tut-11.html", or display "No dice!" if it isn't. It works as expected when I go to "/tutorial/tut-11.html", but I did not get "No dice!" when I tried something like "/not-a-real-path", instead I just got "Not found".

Apologies if I completely misunderstood what "default" is suppose to do since its documentation mentions using boot-file.

@rabbibotton
Copy link
Owner

Routing currently in CLOG is based on what path you associate with you handler is SET-ON-NEW-WINDOW. If you set :PATH to "" than that handler is called if there is no other path to a handler is set. It is possible in that handler (the default handler) to do your own routing by using the functions in clog-location.lisp to look at the url and then just call the handler function you want with the body parameter.

@rabbibotton
Copy link
Owner

rabbibotton commented Apr 10, 2022

For some reason I think I overlooked your issue, and didn't fully understand it or your issue. My deepest apologies. My focus for next release is on "website" development were previously it was on the GUI side predominantly.

The current concept of a "default" route as in tutorial 12 is about a very different situation, and my documentation should have been more clear (fixing). It is the default in a case where a static html file includes the boot.js file but there is no route to specify which on-new-window-handler should handle on the lisp side that page, a far more limited situation.

What you are looking for and now I am working on is a way to handle default URL paths, a far more common website situation.

@rabbibotton rabbibotton reopened this Apr 10, 2022
@rabbibotton
Copy link
Owner

I have pushed some updates to tutorial 12 and other files with better documentation. I am still working on default url paths.

@rabbibotton
Copy link
Owner

I have added "extended-routing" on initializing clog, when enabled allows routes to be extended such that /page1 would also handle /page1/any/thing/you/want

I may still in the future added something similar to easy-routes but the same thing is easily accomplished now by pattern matching on (path-name (location body)) in the handler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants