Add get payload for path method
This commit is contained in:
parent
6217b13504
commit
bde327be02
|
@ -37,6 +37,14 @@
|
|||
(define (directory? file-name)
|
||||
(eq? (stat:type (stat file-name)) 'directory))
|
||||
|
||||
(define (get-payload-for-path path routing-table)
|
||||
"Returns the first payload that matches the routing-table path"
|
||||
(let ((filtered-table
|
||||
(filter (lambda (routing-entry)
|
||||
(not (equal? path (uri-path (car routing-entry)))))
|
||||
routing-table)))
|
||||
(cdr (car filtered-table))))
|
||||
|
||||
(define (serve-file path)
|
||||
(define %prefix `(,(getcwd) "public"))
|
||||
(define (prepend-prefix path) (string-join (append %prefix `(,path)) file-name-separator-string))
|
||||
|
|
Loading…
Reference in New Issue