38 lines
623 B
D
38 lines
623 B
D
import std.experimental.logger;
|
|
import vibe.d;
|
|
|
|
import article;
|
|
import page;
|
|
import project;
|
|
|
|
import cache;
|
|
import http;
|
|
import watcher;
|
|
|
|
void watchTask(T, C)(C *cache, string directory) @safe nothrow {
|
|
do {
|
|
try {
|
|
initPages!T(cache, directory);
|
|
} catch(Exception e) {
|
|
logWarn("Error while watching pages: " ~ e.msg);
|
|
}
|
|
} while(Task.getThis().running);
|
|
}
|
|
|
|
|
|
void main() {
|
|
startHTTPServer();
|
|
|
|
// Start indexing pages.
|
|
runTask({
|
|
watchTask!Page(&pages, "pages");
|
|
});
|
|
runTask({
|
|
watchTask!Article(&articles, "articles");
|
|
});
|
|
runTask({
|
|
watchTask!Project(&projects, "projects");
|
|
});
|
|
runApplication();
|
|
}
|