[英]How to run real phoenix server during test?
我正在使用无法模拟的外部库实现某种棘手的功能。 他们需要对服务器实施真正的请求。 所以,
在测试实施过程中如何运行Web服务器?
PS我的config/test.exs
:
config :my_reelty, MyReelty.Endpoint,
http: [port: {:system, "PORT"}],
url: [host: "localhost", port: 5000] # Specific port
我正在尝试curl http://localhost:5000
但变得curl: (7) Failed to connect to localhost port 5000: Connection refused
您需要将server: true
添加到Endpoint
的配置中:
config :my_reelty, MyReelty.Endpoint, server: true
phoenix.new
可能已经使用server: false
生成了类似的配置(在v1.2.0中对我有用),因此您可以将false
更改为true
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.