[英]Clojure server configuration for SPA's with client-side routing
我正在使用ClojureScript单页应用程序,并且在客户端进行路由。 我想实现一个简单的服务器,该服务器将为我的index.html以及CSS / JS提供服务。 这个想法是将/ static / *以外的所有请求传递到客户端,并允许我的SPA处理它。
事实证明这非常困难。 下面的代码片段是我提出的,但是没有用。
(defroutes routes
(GET "/" []
(resp/content-type template "text/html"))
(context "/static" []
(route/resources "/css" {:root "css"})
(route/resources "/js" {:root "js"}))
(route/not-found
(resp/content-type template "text/html")))
我使用带有自定义处理程序的boot-http。 有可能导致它吗?
听起来您根本不需要后端; 您可以使用boot-http / boot-reload开发并部署到gh-pages,firebase,aws或任何静态文件主机。 参见https://github.com/martinklepsch/tenzing以获取模板项目#nobackend。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.