介绍
中文介绍正在准备中,下面暂时显示原文。
TangoWebAPI
A single shared webserver mod for Fabric/NeoForge that removes boilerplate for other mods. TangoWebAPI provides one embedded HTTP server that mods can use to expose their own endpoints or static assets.
Features
- Shared HTTP server (Java HTTP) for all mods, start/stop in common code.
- Simple API for routes:
get/post/registerRoutewith mod namespace (/modid/...). - Static file serving per mod (
serveStaticwith safe path handling). - Built-in health/info/route listing:
/tango-webapi/health,/tango-webapi/info,/tango-webapi/routes. - Configuration via file (
config/tango-webapi.properties) or env/system props. - Error pages (404/405/503) with simple HTML templates.
Configuration
File: config/tango-webapi.properties
host=0.0.0.0
port=8080
maxRequestBytes=1000000
Or via env/system properties:
TANGO_WEBAPI_HOST/tango.webapi.hostTANGO_WEBAPI_PORT/tango.webapi.portTANGO_WEBAPI_MAX_BYTES/tango.webapi.max_bytes
API for other mods (examples)
// Simple text route at /mymod/ping
TangoWebAPI.get("mymod", "/ping", ctx -> ctx.sendText(200, "pong"));
// JSON response
TangoWebAPI.post("mymod", "/data", ctx -> ctx.sendJson(200, "{\"ok\":true}"));
// Static assets from config/mymod/static under /mymod/static/**
TangoWebAPI.serveStatic("mymod", "static", Path.of("config", "mymod", "static"));
Built-in endpoints
GET /tango-webapi/health– statusGET /tango-webapi/info– host/port/max-bytesGET /tango-webapi/routes– all registered routes incl. prefix routes
Testing
- After game start:
http://localhost:8080/tango-webapi/health/info/routes - Register your own route and hit it via browser/curl.
- Serve a static page under your mod path and verify it loads.
常见问题
Tango Web API 支持哪些 Minecraft 版本?
Tango Web API 支持 Minecraft Java 版 1.21.8–1.21.11,共 3 个版本,可用的加载器:Fabric / NeoForge。下载时注意选择和你游戏版本一致的文件。
Tango Web API 怎么安装?
先用 PCL2 或 HMCL 启动器安装对应版本的 Fabric / NeoForge,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。运行环境:客户端 / 服务端。
Pankraz01 的其他作品
查看全部 →ScamScreener for Hypixel SkyBlock
by Pankraz01, Kd_Gaming1
监控聊天内容,并提醒你注意潜在的骗子
107.9万
3 天前
Modrinth
MarketGuard for Hypixel SkyBlock
by Pankraz01
保护你避免意外出价过高或过低
95.8万
10 天前
Modrinth
GriefLogger Rollback Addon (GLRA)
by Pankraz01
Addon for GriefLogger by DAQUEM to use Rollback Command + Webinterface
5,524
11 个月前
Modrinth
Villager Trade
by Pankraz01
Lets you spawn custom villagers with custom trade options
4,231
10 个月前
Modrinth
评论
登录后评论和评分