Compare commits
2 Commits
3856c39e04
...
af2ad72c00
Author | SHA1 | Date | |
---|---|---|---|
af2ad72c00 | |||
67fb2cecbd |
2466
package-lock.json
generated
Normal file
2466
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
22
package.json
Normal file
22
package.json
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"name": "base-api-ts",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"main": "index.js",
|
||||||
|
"license": "MIT",
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc --project ./",
|
||||||
|
"start:dev": "nodemon src/server.ts",
|
||||||
|
"start:prod": "node dist/server.js"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"express": "^4.17.1",
|
||||||
|
"ts-node-dev": "^2.0.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/express": "^4.17.11",
|
||||||
|
"@types/node": "^14.14.22",
|
||||||
|
"nodemon": "^2.0.7",
|
||||||
|
"ts-node": "^10.9.1",
|
||||||
|
"typescript": "^4.1.3"
|
||||||
|
}
|
||||||
|
}
|
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);
|
16
tsconfig.json
Normal file
16
tsconfig.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "commonjs",
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"target": "es6",
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"sourceMap": true,
|
||||||
|
"outDir": "dist",
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"*": ["node_modules/*"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"include": ["src/**/*"]
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user