first commit
This commit is contained in:
28
backend/build.gradle.kts
Normal file
28
backend/build.gradle.kts
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
import org.gradle.jvm.tasks.Jar
|
||||
|
||||
description = "Umbrella : Backend"
|
||||
|
||||
plugins {
|
||||
application
|
||||
}
|
||||
|
||||
application{
|
||||
mainClass = "de.srsoftware.umbrella.backend.Application"
|
||||
}
|
||||
|
||||
dependencies{
|
||||
implementation(project(":translations"))
|
||||
implementation(project(":web"))
|
||||
implementation("de.srsoftware:tools.http:6.0.0")
|
||||
}
|
||||
|
||||
tasks.jar {
|
||||
manifest.attributes["Main-Class"] = "de.srsoftware.umbrella.backend.Application"
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
val dependencies = configurations
|
||||
.runtimeClasspath
|
||||
.get()
|
||||
.map(::zipTree) // OR .map { zipTree(it) }
|
||||
from(dependencies)
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/* © SRSoftware 2025 */
|
||||
package de.srsoftware.umbrella.backend;
|
||||
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
import static java.lang.System.Logger.Level.INFO;
|
||||
|
||||
import com.sun.net.httpserver.HttpServer;
|
||||
import de.srsoftware.tools.ColorLogger;
|
||||
import de.srsoftware.umbrella.translations.Translations;
|
||||
import de.srsoftware.umbrella.web.WebHandler;
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
public class Application {
|
||||
private static final System.Logger LOG = System.getLogger("Umbrella");
|
||||
public static void main(String[] args) throws IOException {
|
||||
ColorLogger.setRootLogLevel(DEBUG);
|
||||
LOG.log(INFO, "Starting Umbrella:");
|
||||
var port = 8080;
|
||||
var threads = 16;
|
||||
HttpServer server = HttpServer.create(new InetSocketAddress(port), 0);
|
||||
server.setExecutor(Executors.newFixedThreadPool(threads));
|
||||
new WebHandler().bindPath("/").on(server);
|
||||
new Translations().bindPath("/api/translations").on(server);
|
||||
LOG.log(INFO,"Started web server at {0}",port);
|
||||
server.start();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user