Start create helios distribution api
This commit is contained in:
parent
67fb2cecbd
commit
af2ad72c00
26
src/app.ts
Normal file
26
src/app.ts
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import express from "express";
|
||||||
|
|
||||||
|
import routes from "./routes/routes";
|
||||||
|
import minecraft_routes from "./routes/minecraft/minecraft_routes";
|
||||||
|
|
||||||
|
class App {
|
||||||
|
public server;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.server = express();
|
||||||
|
|
||||||
|
this.middlewares();
|
||||||
|
this.routes();
|
||||||
|
}
|
||||||
|
|
||||||
|
middlewares() {
|
||||||
|
this.server.use(express.json());
|
||||||
|
}
|
||||||
|
|
||||||
|
routes() {
|
||||||
|
this.server.use(routes);
|
||||||
|
this.server.use('/minecraft', minecraft_routes)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default new App().server;
|
55
src/minecraft/1.12.2/heliosDistribution.ts
Normal file
55
src/minecraft/1.12.2/heliosDistribution.ts
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
import internal from "stream"
|
||||||
|
import { Url } from "url"
|
||||||
|
|
||||||
|
interface HeliosDistribution{
|
||||||
|
version:string
|
||||||
|
//servers:Minecraft_1_12_2_server
|
||||||
|
}
|
||||||
|
|
||||||
|
interface MinecraftServer{
|
||||||
|
id:string
|
||||||
|
name:string
|
||||||
|
description:string
|
||||||
|
icon:string
|
||||||
|
version:string
|
||||||
|
address:string
|
||||||
|
minecraftVersion:string
|
||||||
|
mainServer:boolean
|
||||||
|
autoconnect:boolean
|
||||||
|
share_required_mods:ForgeMod[]
|
||||||
|
client_required_mods:ForgeMod[]
|
||||||
|
client_optional_mods:ForgeMod[]
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ForgeMod{
|
||||||
|
id:ForgeModId
|
||||||
|
name:string
|
||||||
|
type:string
|
||||||
|
artifact:ForgeModArtifact
|
||||||
|
sub_modules:ForgeMod[]
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ForgeModId{
|
||||||
|
class:string
|
||||||
|
label:string
|
||||||
|
version:string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ForgeModArtifact{
|
||||||
|
size:number
|
||||||
|
MD5:string
|
||||||
|
url:Url
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class Minecraft{
|
||||||
|
constructor(){
|
||||||
|
this.generateDistribution = this.generateDistribution.bind(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
public generateDistribution() {
|
||||||
|
var distribution: HeliosDistribution = {
|
||||||
|
version: "12.254"
|
||||||
|
}
|
||||||
|
return distribution
|
||||||
|
}
|
||||||
|
}
|
17
src/routes/minecraft/1_12_2/routes.ts
Normal file
17
src/routes/minecraft/1_12_2/routes.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import { Router } from "express";
|
||||||
|
import Minecraft from "../../../minecraft/1.12.2/heliosDistribution"
|
||||||
|
|
||||||
|
const minecraft = new Minecraft //Is this right?
|
||||||
|
const routes = Router();
|
||||||
|
|
||||||
|
routes.get("/", (req, res) => {
|
||||||
|
return res.json({ message: "yes" });
|
||||||
|
});
|
||||||
|
|
||||||
|
routes.get("/distribution", (req, res) =>{
|
||||||
|
res.send(minecraft.generateDistribution())
|
||||||
|
});
|
||||||
|
|
||||||
|
export default routes;
|
||||||
|
|
||||||
|
|
11
src/routes/minecraft/minecraft_routes.ts
Normal file
11
src/routes/minecraft/minecraft_routes.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import { Router } from "express";
|
||||||
|
import minecraft_1_12_2_routes from './1_12_2/routes'
|
||||||
|
|
||||||
|
const routes = Router();
|
||||||
|
|
||||||
|
routes.get("/", (req, res) => {
|
||||||
|
return res.json({ message: "Hello World" });
|
||||||
|
});
|
||||||
|
routes.use
|
||||||
|
routes.use('/1.12.2', minecraft_1_12_2_routes)
|
||||||
|
export default routes;
|
9
src/routes/routes.ts
Normal file
9
src/routes/routes.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import { Router } from "express";
|
||||||
|
|
||||||
|
const routes = Router();
|
||||||
|
|
||||||
|
routes.get("/", (req, res) => {
|
||||||
|
return res.json({ message: "Hello World" });
|
||||||
|
});
|
||||||
|
|
||||||
|
export default routes;
|
3
src/server.ts
Normal file
3
src/server.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import app from "./app";
|
||||||
|
|
||||||
|
app.listen(3000);
|
Loading…
Reference in New Issue
Block a user