1
0
mirror of https://github.com/urlysses/1991.git synced 2024-11-30 14:31:39 -05:00
1991/examples/app.fs

43 lines
1.0 KiB
Forth
Raw Normal View History

2017-02-15 12:23:28 -05:00
\ App demo:
include ../1991.fs
2017-02-15 12:23:28 -05:00
sourcedir s" public" s+ set-public-path
sourcedir s" views/" s+ set-view-path
2017-02-15 12:23:28 -05:00
: handle-/ s" fff" ;
: handle-hi s" hi!" ;
\ Basic routing:
2017-02-15 12:23:28 -05:00
/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
2017-02-15 12:23:28 -05:00
8080 1991: