有没有办法在运行http-kit服务器时注册多个处理程序:
override func viewDidLoad() {
super.viewDidLoad()
UserActivity.trackScreen(name: self.selectedItem.title) // I think this is not set yet, it is nil.
}
如何将两条路由传递给运行服务器,例如rest-main-app和rest-events-app?
答案 0 :(得分:6)
您可以使用compojure的routes
功能。您还可以将多个处理程序传递给defroutes
,下面提供了一个示例:
(defroutes get-routes
(GET "/events" [] "Event API")
(GET "/" [] "Welcome"))
(defroutes post-routes
(POST "/events" [] "Post Event API"))
(def all-routes
(routes
get-routes
post-routes))
(defn -main []
(run-server all-routes {:port 5000}))