I'm bundling a "static" web application inside the JAR and under load, the usual
javaClass.getResourceAsStream(...)?.use { inputStream -> ... }
causes a bottleneck.
What I've done before is to read those files into a hashmap into memory on the first read, but when it's a lot of files, then it's starting to use up memory unnecessarily, so I've started looking into AsynchronousFileChannel
Having the web application inside the JAR and served by the same backend that's handling the POST requests has quite a few benefits like not having to deal with CORS