如何使用Intellij中的compojure [英] How to use compojure from Intellij

查看:108
本文介绍了如何使用Intellij中的compojure的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想花更多的时间来尝试编译和运行intellij的compojure应用程序。在命令行中,我使用lein ring server-headless。如果我是从intellij内部运行的,则REPL将启动,并且无法从REPL内部调用或启动服务器。如何从REPL内部编译和运行服务器?

I've spent more time that I want to admit trying to compile and run a compojure app from intellij. From the command line I use lein ring server-headless. If I run from inside intellij the REPL begins and I can't call or start the server from inside the REPL. How can I compile and run a server from inside the REPL?

推荐答案

您要从repl内部运行服务器吗?

You want to run the server from inside the repl?

在REPL中添加 [ring / ring-jetty-adapter 1.3.1] 作为依赖项

Add [ring/ring-jetty-adapter "1.3.1"] as a dependency

(需要'ring.adapter.jetty)

(需要'quals.core.handler);要求包含处理程序的您的 ns

(require 'quals.core.handler) ; require YOUR ns containing the handler

(ring.adapter.jetty / run-jetty quals.core.handler / app {:port 3004})

您可以在此处查看所有可以传递的参数:
http://mmcgrana.github.io/ring/ring.adapter.jetty.html

You can see all the parameters you can pass here: http://mmcgrana.github.io/ring/ring.adapter.jetty.html

已经有了,服务器正在您的repl中运行。如果您需要更多内容,可以随时查看 weavejester / lein-ring 的源代码。

There you have it, the server is running in your repl. If you were looking for more, you can always look at weavejester/lein-ring's source code.

玩转Clojuring:)

Have fun Clojuring around :)

这篇关于如何使用Intellij中的compojure的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆