{"id":17504649,"url":"https://github.com/offsetmods538/mesh-lib","last_synced_at":"2026-02-08T12:17:12.501Z","repository":{"id":258562779,"uuid":"871630316","full_name":"OffsetMods538/MESH-Lib","owner":"OffsetMods538","description":"Easy to use library for hosting an HTTP server on the Minecraft server's port","archived":false,"fork":false,"pushed_at":"2025-01-02T18:30:10.000Z","size":139,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-24T17:01:50.937Z","etag":null,"topics":["http","http-server","minecraft","minecraft-fabric","minecraft-library","minecraft-mod","netty","netty-http","netty-server"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OffsetMods538.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-12T13:54:53.000Z","updated_at":"2025-01-28T11:46:23.000Z","dependencies_parsed_at":"2024-10-19T15:40:48.117Z","dependency_job_id":null,"html_url":"https://github.com/OffsetMods538/MESH-Lib","commit_stats":null,"previous_names":["offsetmods538/mesh-lib"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OffsetMods538%2FMESH-Lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OffsetMods538%2FMESH-Lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OffsetMods538%2FMESH-Lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OffsetMods538%2FMESH-Lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OffsetMods538","download_url":"https://codeload.github.com/OffsetMods538/MESH-Lib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248281388,"owners_count":21077423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["http","http-server","minecraft","minecraft-fabric","minecraft-library","minecraft-mod","netty","netty-http","netty-server"],"created_at":"2024-10-20T01:15:01.625Z","updated_at":"2025-10-06T06:07:42.877Z","avatar_url":"https://github.com/OffsetMods538.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MESH Lib\n[![discord-singular](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/social/discord-singular_vector.svg)](https://discord.offsetmonkey538.top/)\n[![modrinth](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/available/modrinth_vector.svg)](https://modrinth.com/mod/mesh-lib)  \n\nEasy to use library for running your HTTP server on the same port as the Minecraft server.  \nAvailable for both fabric and paper.\n\nJavadoc is available [here](https://maven.offsetmonkey538.top/javadoc/releases/top/offsetmonkey538/meshlib/mesh-lib/latest)\n\n## Version Support\nI am hoping to keep this mod supported for 1.19 up to latest.\n\n## Usage\n### Players\nPlayers shouldn't ever need to install this mod.  \nIt should be JIJ-ed by mod devs\n\n### Mod Devs\n\n#### Gradle\nAdd my maven repo to your repositories block:\n```groovy\nrepositories {\n    // Others\n    \n    maven {\n        name = \"OffsetMods538\"\n        url = \"https://maven.offsetmonkey538.top/releases\"\n        content {\n            includeGroup \"top.offsetmonkey538.meshlib\"\n        }\n    }\n}\n```\n\nThis library is meant to be used as a JIJ (Jar-In-Jar), meaning you include it inside your mod/plugin.  \nTo do that you can use `include` for fabric and the shadow gradle plugin for paper:  \n```groovy\ndependencies {\n    // For fabric\n    include modImplementation(\"top.offsetmonkey538.meshlib:mesh-lib-fabric:1.0.4+1.21.4\")\n    \n    // For paper\n    implementation \"top.offsetmonkey538.meshlib:mesh-lib-paper:1.0.4+1.21.4\"\n}\n```\nMake sure to use the latest version.\n\n#### Using\n\nLet's write a simple http server that will live at `http://server.com:25565/simple-server` and just serve `\"Hello, World!\"` in plain text!\n\nFirst we'll need the actual `HttpHandler`, for that we'll create a new class, let's call it `MyHttpHandler`.  \nThis class has to implement the `HttpHandler` interface, this will look something like this:\n```java\npublic class MyHttpHandler implements HttpHandler {\n\n    @Override\n    public void handleRequest(@NotNull ChannelHandlerContext ctx, @NotNull FullHttpRequest request) throws Exception {\n        // Logic will go here\n    }\n}\n```\n\nNow we'll need to actually implement the handler. You can google \"HTTP Netty\" for more info on how to handle HTTP requests with Netty.\n```java\npublic void handleRequest(@NotNull ChannelHandlerContext ctx, @NotNull FullHttpRequest request) throws Exception {\n    // Write \"Hello, World!\" to a buffer, encoded in UTF-8\n    final ByteBuf content = Unpooled.copiedBuffer(\"Hello, World!\", StandardCharsets.UTF_8);\n    // Create a response with said buffer\n    final FullHttpResponse response = new DefaultFullHttpResponse(HTTP_1_1, OK, content);\n\n    // Set the \"CONTENT_TYPE\" header to tell the browser that this is plain text encoded in UTF-8\n    response.headers().set(CONTENT_TYPE, \"text/plain; charset=UTF-8\");\n\n\n    // Send the response and close the connection\n    ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE);\n}\n```\n\nFinally, you'll need to actually register your handler. Put this in your mod or plugin initializer:\n```java\n@Override\npublic void onInitializeServer() {\n    // Others\n    \n    HttpHandlerRegistry.INSTANCE.register(\"simple-server\", new MyHttpHandler());\n}\n```\nThe id is the path that your handler will be able to listen on, in this case `server:port/simple-server`. For compatibility reasons, no mod is allowed to occupy the root path.  \nIf you need to listen to multiple paths (`server:port/simple-server/test` and `server:port/simple-server/test2`), then use `request.uri()` inside your handler, do **not** use `simple-server/test` as the id, it **will not** work.\n\nNow, if you launch the server and try visiting `localhost:25565/simple-server` in your browser of choice, you should be greeted with a nice welcome message :D  \nIf not, then come yell at me on my [discord](http://discord.offsetmonkey538.top).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foffsetmods538%2Fmesh-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foffsetmods538%2Fmesh-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foffsetmods538%2Fmesh-lib/lists"}