diff --git a/src/global_service.ts b/src/global_service.ts new file mode 100644 index 0000000..aa5da80 --- /dev/null +++ b/src/global_service.ts @@ -0,0 +1,14 @@ +import { Request, Response, NextFunction, response } from "express"; + +export default class GlobalService { + public static getVersions = async ( + req: Request, + res: Response, + next: NextFunction + ) => { + return res.status(200).json({ + beat: '2022.02.27', + }); + }; + +} diff --git a/src/routes/global.ts b/src/routes/global.ts new file mode 100644 index 0000000..600093d --- /dev/null +++ b/src/routes/global.ts @@ -0,0 +1,8 @@ +import express from "express"; +import PackAPI from "../pack_api"; +import PackUploader from "../pack_upload"; +import GlobalService from "../global_service"; + +export const globalRoutes = express.Router(); + +globalRoutes.get("/versions", GlobalService.getVersions); diff --git a/src/server.ts b/src/server.ts index c28e9b0..3ecdc8c 100644 --- a/src/server.ts +++ b/src/server.ts @@ -3,6 +3,7 @@ import express, { Express } from "express"; import morgan from "morgan"; import os from "os"; import { packRoutes } from "./routes/packs"; +import { globalRoutes } from "./routes/global"; import PackAPI from "./pack_api"; import PackService from "./services/pack_service"; @@ -48,7 +49,7 @@ router.use((req, res, next) => { /** Routes */ router.use("/", packRoutes); - +router.use("/", globalRoutes); /** Error handling */ router.use((req, res, next) => { const error = new Error("not found");