Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Global configuration
const port: number = Number(process.env.PORT) || 3000;
const gitlabAPIUrl: string = "https://gitlab.com/api/v4";
// Http promise requests
import * as axios from "axios";
// Express Html Application
import * as express from "express";
const app: express.Application = express.default();
// Requests Logger Middleware
import * as morgan from "morgan";
app.use(morgan.default("tiny"));
// Function to add API Url to a partial path
const api = (path: string) => gitlabAPIUrl + path;
// Open API CORS Headers
app.use(
(req: express.Request, res: express.Response, next: express.NextFunction) => {
res.header("Access-Control-Allow-Origin", "*");
next();
}
);
// Get a specific group with subgroups
app.get("/groups/:id", (req: express.Request, res: express.Response) => {
Promise.all([
axios.default.get(api(`/groups/${req.params.id}`)),