+ 404 page
This commit is contained in:
Alexander Zhirov 2023-06-05 00:35:45 +03:00
parent 7a71bb7e01
commit 639118f781
3 changed files with 13 additions and 1 deletions

View File

@ -27,6 +27,10 @@ private void showVersion() {
writefln("daster версия %s, собрано %s", getDasterVersion(), __DATE__);
}
void page404(HTTPServerRequest req, HTTPServerResponse res, HTTPServerErrorInfo error) {
res.render!("404.dt", req, error);
}
int main(string[] args) {
log.level(log.INFORMATION);
log.output(log.SYSLOG);
@ -99,12 +103,14 @@ int main(string[] args) {
auto settingsHTTPS = new HTTPServerSettings;
if (webHost.http) {
settingsHTTP.errorPageHandler = toDelegate(&page404);
settingsHTTP.sessionStore = memorySessionStore;
settingsHTTP.port = webHost.http;
settingsHTTP.bindAddresses = ["::1"] ~ webHost.addresses;
}
if (webHost.https) {
settingsHTTPS.errorPageHandler = toDelegate(&page404);
settingsHTTPS.sessionStore = memorySessionStore;
settingsHTTPS.port = webHost.https;
settingsHTTPS.bindAddresses = ["::1"] ~ webHost.addresses;

View File

@ -1,3 +1,3 @@
module version_;
enum dasterVersion = "v0.0.8";
enum dasterVersion = "v0.0.9";

6
views/404.dt Normal file
View File

@ -0,0 +1,6 @@
doctype html
head
title 404
body
div
p Страница не найдена