1
0
mirror of https://github.com/urlysses/1991.git synced 2024-12-01 14:54:37 -05:00
1991/examples/app.fs
urlysses 7ff8c9942e Finalize url mapping/url pattern matching.
All that was missing in 574c33c27e was a
way to retreive the values of our fuzzy matches.
2017-02-24 23:29:43 -05:00

43 lines
1.0 KiB
Forth

\ App demo:
include ../1991.fs
sourcedir s" public" s+ set-public-path
sourcedir s" views/" s+ set-view-path
: handle-/ s" fff" ;
: handle-hi s" hi!" ;
\ Basic routing:
/1991 / handle-/
/1991 /hi handle-hi
\ Views:
: page-title s" hmmmm" ;
: handle-/index
s" index.html" render-view ;
: handle-import
s" import-version.html" render-view ;
/1991 /index handle-/index
/1991 /import handle-import
: handle-uid
s" uid:" get-query-string s+ ;
: handle-uid-new
s" uid:new:" get-query-string s+ ;
: handle-uid-delete
s" uid:delete:" get-query-string s+ ;
: handle-pid
s" pid:" get-query-string s+ ;
: handle-pid-new
s" pid:new:" get-query-string s+ ;
: handle-pid-delete
s" pid:delete:" get-query-string s+ ;
/1991 /api/v1/users/<uid> handle-uid
/1991 /api/v1/users/<uid>/new handle-uid-new
/1991 /api/v1/users/<uid>/delete handle-uid-delete
/1991 /api/v1/users/<uid>/post/<pid> handle-pid
/1991 /api/v1/users/<uid>/post/<pid>/new handle-pid-new
/1991 /api/v1/users/<uid>/post/<pid>/delete handle-pid-delete
8080 1991: