Am 10.08.2014 04:15, schrieb dat:
Hi all,
n00b here, I have a project built with vibe using dub that is working perfectly. Now I need to implement a different tool (that will periodically run from crontab) and I would like to use vibe.http.client.requestHTTP to make some GET requests from the script. Is it possible? How? Should I compile vibe as a library? If yes, how?
Any suggestion is more than welcome,
dat
I would just use DUB to build a binary (using dub build
). The binary
will have vibe.d statically linked in, so that doesn't need to be built
or deployed separately. For a short-living command line tool, you will
also probably want to specify "versions": ["VibeCustomMain"]
in the
project's dub.json and then define your own main()
function:
void main()
{
import vibe.http.client;
requestHTTP(...);
}
alternatively (with "VibeDefaultMain"
) it would currently be necessary
to explicitly call exitEventLoop()
:
shared static this()
{
import vibe.core.core;
import vibe.http.client;
runTask({
requestHTTP(...);
exitEventLoop();
});
}
Hope this helps.