Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. (ql:quickload :caveman-jscl)
  2.  
  3. (defpackage caveman-jscl.app
  4. (:use :cl)
  5. (:import-from :lack.builder
  6. :builder)
  7. (:import-from :ppcre
  8. :scan
  9. :regex-replace)
  10. (:import-from :caveman-jscl.web
  11. :*web*)
  12. (:import-from :caveman-jscl.config
  13. :config
  14. :productionp
  15. :*static-directory*
  16. :*base-url*))
  17. (in-package :caveman-jscl.app)
  18.  
  19. (builder
  20. (:static
  21. :path (lambda (path)
  22. ;; /caveman/css/main.css にアクセスすると path に /caveman/css/main.css が入るようで、404となる
  23. ;; ここで /caveman を削ると main.cssの内容がレスポンスされる
  24. (if (ppcre:scan "^(?:/images/|/css/|/js/|/robot\\.txt$|/favicon\\.ico$)" path)
  25. path
  26. nil))
  27. :root *static-directory*)
  28. (if (productionp)
  29. nil
  30. :accesslog)
  31. (if (getf (config) :error-log)
  32. `(:backtrace
  33. :output ,(getf (config) :error-log))
  34. nil)
  35. :session
  36. (if (productionp)
  37. nil
  38. (lambda (app)
  39. (lambda (env)
  40. (let ((datafly:*trace-sql* t))
  41. (funcall app env)))))
  42. (:mount *base-url* *web*) ; 引数の数違うと怒られたので、mount-appに*web*を渡した
  43. *web*)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement