控制台在启动 cro ('cro run') 后显示此消息:
▶ Starting JoanPujol (JoanPujol)
**Endpoint HTTP will be at http://localhost:20000/**
JoanPujol Listening at http://localhost:3000
JoanPujol Shutting down...
♻ Restarting JoanPujol (JoanPujol)
JoanPujol Listening at http://localhost:3000
我无法弄清楚“端点 HTTP”的定义位置。这是我的“ service.p6 ”:
use Cro::HTTP::Log::File;
use Cro::HTTP::Server;
use Routes;
constant HOST = 'localhost';
constant PORT = 3000;
my Cro::Service $http = Cro::HTTP::Server.new(
:http<1.1>,
host => HOST,
port => PORT,
application => routes(),
after => [
Cro::HTTP::Log::File.new(logs => $*OUT, errors => %*ERR)
]
);
$http.start;
say "Listening at http://{HOST}:{PORT}";
react {
whenever signal(SIGINT) {
say "Shutting down...";
$http.stop;
done;
}
}
谢谢!