[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Artanis] URL Mapping w/o redirect-to?
From: |
Nala Ginrut |
Subject: |
Re: [Artanis] URL Mapping w/o redirect-to? |
Date: |
Sun, 17 Mar 2019 04:15:02 +0800 |
User-agent: |
mu4e 1.0; emacs 25.1.1 |
Hi Marc!
Marc Dunivan writes:
> Hello:
>
> Using art (MVC).
> $ art draw controller index show
>
> What rule do I put into ENTRY to have http://127.0.0.1/index show
> http://127.0.0.1/index/show without redirecting to
> http://127.0.0.1/index/show?
I guess you need router just like what RoR does.
Unfortunately I haven't done it. It's not hard to implement. The
prefered way is that you may just need to modify the file ROUTE in the
top-level to redirect. This is useful to avoid to write many redundant
rules.
I may add it in the next release. For now, you may need to use redirect-to
> This works, but redirects in the browser:
> (get "^/index/?$" (lambda (rc) (redirect-to rc "/index/show")))
>
> This also works, but doesn't call the controller
> /app/controllers/index.scm, it calls the template directly:
> (get "^/index/?$" (lambda () (tpl->response "app/views/index/show.html.tpl"
> )))
The default activity after controller generation is to render a default
template, you may modify the handler in (index-define show ...)
>
> (get "^/index/?$" (lambda (rc) (???? response-emit
> http://127.0.0.1/index/show ???)))
>
> Sincerely,
--
GNU Powered it
GPL Protected it
GOD Blessed it
HFG - NalaGinrut
Fingerprint F53B 4C56 95B5 E4D5 6093 4324 8469 6772 846A 0058
signature.asc
Description: PGP signature