LibJF/docs/libjf-web-v1.md

839 B

libjf-web-v1

libjf-web-v1 provides an HTTP web server you can use in your serverside (and technically also clientside) mods to serve web content through a unified port. libjf-web-v1 depends on libjf-config-core-v2 to provide its config, libjf-base, fabric-lifecycle-events-v1 and fabric-command-api-v1

Getting started

Implement WebInit and register it as a libjf:web entrypoint. To enable the server, also add the following to your fabric.mod.json:

{
  "custom": {
    "libjf": {
      "web": true
    }
  }
}

Please be aware that your entrypoint may be called multiple times during one session. You can register content providers using the register* methods on the WebServer parameter of your entrypoint. Please do not store it in a field, you may instead use WebServer.getInstance() if you wish to access it elsewhere.