Gymboard/gymboard-uploads/source/app.d

25 lines
692 B
D
Raw Normal View History

2023-03-29 15:29:19 +00:00
import std.stdio;
import handy_httpd;
import handy_httpd.handlers.path_delegating_handler;
import handlers;
void main() {
PathDelegatingHandler pathHandler = new PathDelegatingHandler();
pathHandler.addMapping("GET", "/status", (ref HttpRequestContext ctx) {
ctx.response.writeBodyString("online");
});
pathHandler.addMapping("POST", "/uploads", new VideoUploadHandler());
HttpServer server = new HttpServer(pathHandler, getServerConfig());
server.start();
}
private ServerConfig getServerConfig() {
ServerConfig serverConfig = ServerConfig.defaultValues();
serverConfig.port = 8085;
serverConfig.workerPoolSize = 10;
serverConfig.reuseAddress = true;
return serverConfig;
}