feat: add global functions like versions
parent
434a54b038
commit
ca989d7a23
|
@ -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',
|
||||
});
|
||||
};
|
||||
|
||||
}
|
|
@ -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);
|
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue